GreenFanta Posted January 16, 2011 Share Posted January 16, 2011 Hello! I am busy developing a script that returns all users that have the cell "Available" set to 1 but I am unsure how to do this, I am familiar with basic SQL and I have made this: $sql = "SELECT * FROM `clans` WHERE `available` =1 LIMIT 0 , 30"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); echo ($row['name']); but it only displays information from the first row found, and I want it to display all the rows found, how can I do this? Thanks - GreenFanta Link to comment https://forums.phpfreaks.com/topic/224611-displaying-more-than-one-found-result-in-a-query/ Share on other sites More sharing options...
dragon_sa Posted January 16, 2011 Share Posted January 16, 2011 $sql = "SELECT * FROM `clans` WHERE `available` =1 LIMIT 0 , 30"; $result = mysql_query($sql); if (mysql_num_rows($result)!=0) { while ($row = mysql_fetch_assoc($result)) { echo ($row['name']); } } Link to comment https://forums.phpfreaks.com/topic/224611-displaying-more-than-one-found-result-in-a-query/#findComment-1160261 Share on other sites More sharing options...
GreenFanta Posted January 16, 2011 Author Share Posted January 16, 2011 Thank you for your fast response, it works, thanks again! Link to comment https://forums.phpfreaks.com/topic/224611-displaying-more-than-one-found-result-in-a-query/#findComment-1160262 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.