Corey 0 Report post Posted January 27, 2005 i have a problem with this script...it should display a content from a row in mysql database...defined by variable $id <?phpinclude "db.php";$query = "SELECT title, content FROM articles WHERE id='$id'";$article=mysql_query($query);while ($r=mysql_fetch_array($article)){$title=$r["title"];$content=$r["content"];echo "<b>$title</b>";echo "<br><br>$content";}?> the problem is that it displays only the content from the last row in the mysql database...but not the content defined by $id (...WHERE id=$id...)....something is strange...because the script worked in the morning...and i've changed something...and it doesn't..???then i uploaded the old file on the server (that worked) and nothing?..the same thing again...please help me....btwthe script is a part of "article system"... Share this post Link to post Share on other sites
Corey 0 Report post Posted January 27, 2005 it's OK now...i solved the problem my self ..tnx anyway;) Share this post Link to post Share on other sites
Roly 0 Report post Posted January 28, 2005 This is the way I would code your script >_> <?phpinclude 'db.php';$article=mysql_query('SELECT title, content FROM articles WHERE id = \''.$id.'\'');while ($r=mysql_fetch_array($article)) echo '<b>'.$r['title'].'</b><br /><br />'.$r['content'];?> Don't waste your time coding unessesary stuff like extra variables or two echo functions when you only need one. BTW using single quotes is faster Share this post Link to post Share on other sites