Darkangel Posted January 2, 2007 Report Share Posted January 2, 2007 Kads man var palidzet ar so scriptu es jau mokos vienu laiku un netieku skaidriba es gribu lai vins no datu bazes nolasa avatar nosaukumu piem devil.jpg un parada vinu mana profila <?php require_once('auth.php'); ?> <center> <?php $id = $auth->userid; $username = $auth->username; require("connect.php"); $sql = "SELECT * FROM user WHERE avatar = '$id'"; $res = mysql_query($sql); $row = mysql_fetch_array($res); echo '<img border="0" src="avatar/$row["avatar"]" width="100" height="100"><br>'; echo "User logged:".$username."<br>"; echo "Userid:".$id."<br>"; ?> </center> Link to comment Share on other sites More sharing options...
andrisp Posted January 2, 2007 Report Share Posted January 2, 2007 Vaina ir šeit: echo '<img border="0" src="avatar/$row["avatar"]" width="100" height="100"><br>'; Strings starp ' pēdiņām netiek pārsēts, tāpēc $row['avatar'] netiek apmainīts pret attiecīgo tā vērtību. Link to comment Share on other sites More sharing options...
Darkangel Posted January 2, 2007 Author Report Share Posted January 2, 2007 Es nomainiju pedinas un tagad vins met man ara sadu error Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in F:\AppServ\www\test\index.php on line 13 Link to comment Share on other sites More sharing options...
Stopp Posted January 2, 2007 Report Share Posted January 2, 2007 echo '<img border="0" src="avatar/'.$row["avatar"].'" width="100" height="100"><br>'; Link to comment Share on other sites More sharing options...
andrisp Posted January 2, 2007 Report Share Posted January 2, 2007 Hrrr.. Ja stringu iekļauj iekš dubultpēdiņām, tad visas dubulpēdiņas, kas parādās stringā, ir jāeskeipo ar \. Bet vispār dari labāk šādi: echo '<img border="0" src="avatar/'.$row["avatar"].'" width="100" height="100"><br>'; Un apgūsti php pamatus ;). Link to comment Share on other sites More sharing options...
Darkangel Posted January 2, 2007 Author Report Share Posted January 2, 2007 Censos jau apgut tik nevar normalu literaturu lat valoda pa to atrast Un paldies aizgaja bez erroriem bet tagad man jaizdoma kape vins nerada bildes linku kas datubaze ira ielikta! Link to comment Share on other sites More sharing options...
andrisp Posted January 2, 2007 Report Share Posted January 2, 2007 Paskaties, kas rādās uzģenerētajā sourcē. PS. Pieturzīmes! Link to comment Share on other sites More sharing options...
Darkangel Posted January 2, 2007 Author Report Share Posted January 2, 2007 Tu biji domajis so source? <center> <img border="0" src="avatar/" width="100" height="100"><br>User logged:Testman<br>Userid:1<br> </center> Link to comment Share on other sites More sharing options...
andrisp Posted January 2, 2007 Report Share Posted January 2, 2007 Pārbaudi vai tev vispār kaut ko atgriež kverijs: SELECT * FROM user WHERE avatar = '$id' Link to comment Share on other sites More sharing options...
Darkangel Posted January 2, 2007 Author Report Share Posted January 2, 2007 Ne neatgriez vins neko man. Link to comment Share on other sites More sharing options...
andrisp Posted January 2, 2007 Report Share Posted January 2, 2007 Nu tad meklē, kur vaina. Vai $id vispār ir definēts, etc etc. Link to comment Share on other sites More sharing options...
Darkangel Posted January 2, 2007 Author Report Share Posted January 2, 2007 Tu doma vai vins vispar ira datubaze vai ka savadak? Link to comment Share on other sites More sharing options...
andrisp Posted January 2, 2007 Report Share Posted January 2, 2007 Vispirms pārbaudi, vai iekš skripta $id vispār kaut ko satur. (php.net/print_r) Ja ir, tad skaties vai tāda vērtība vispār ir iekš tabulas. Link to comment Share on other sites More sharing options...
Darkangel Posted January 2, 2007 Author Report Share Posted January 2, 2007 Ja ira vinam jo tas $id tiek nemts no auth.php jo tur ieksa ira login scripta cookies vai sesion. Link to comment Share on other sites More sharing options...
andrisp Posted January 2, 2007 Report Share Posted January 2, 2007 Tu pārbaudīji ? Link to comment Share on other sites More sharing options...
Recommended Posts