Eggzorcist Posted August 19, 2010 Share Posted August 19, 2010 I'm having trouble with listing a query with while loops... What am I doing wrong? $user = $database->escape_value($_SESSION['username']); while($row = mysql_fetch_assoc($database->query("SELECT * FROM project WHERE user = '{$user}'"))){ echo $row['name']; } THank you Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted August 19, 2010 Share Posted August 19, 2010 You are re-executing the query in a forever-loop because you put the code that executes the query inside of the while() condition. You would need to execute the query once, before the start of the while(){} loop, not inside of the while() condition. The while(){} loop should only iterate over the result set that the query returns. Quote Link to comment 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.