MDanz Posted May 18, 2010 Share Posted May 18, 2010 the top code works and the bottom doesn't. I'm sure their identical.. can any one spot the problem. The top echo's $sumz... the bottom comes up blank. <?php mysql_connect("localhost", "Master", "pword"); mysql_select_db("db"); $column= mysql_query("SELECT * FROM Reply WHERE origin=5 ORDER by posted DESC")or die (mysql_error()); while($row3 = mysql_fetch_assoc($column)) { $avatar = htmlentities($row3['avatar']); $usern = htmlentities($row3['username']); $sumz = htmlentities($row3['reply']); } echo $sumz; ?> <?php mysql_connect("localhost", "Master", "pword"); mysql_select_db("db"); $run = mysql_query("SELECT * FROM Reply WHERE origin=5 ORDER by posted DESC")or die (mysql_error()); while($runrows = mysql_fetch_assoc($run)); { $usern = htmlentities($runrows['username']); $sumz = htmlentities($runrows['reply']); $imagelocation = htmlentities($runrows['image']); } echo $sumz; ?> Quote Link to comment https://forums.phpfreaks.com/topic/202180-weird-mysql-problem/ Share on other sites More sharing options...
andrewgauger Posted May 18, 2010 Share Posted May 18, 2010 There is a semicolon at the end of your while statement in sample 2. Quote Link to comment https://forums.phpfreaks.com/topic/202180-weird-mysql-problem/#findComment-1060172 Share on other sites More sharing options...
MDanz Posted May 18, 2010 Author Share Posted May 18, 2010 thanks sir Quote Link to comment https://forums.phpfreaks.com/topic/202180-weird-mysql-problem/#findComment-1060173 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.