max_w1 Posted March 9, 2008 Share Posted March 9, 2008 hi, i am trying to display recrods in a php page with a query like this: $fighter = mysql_query ("SELECT `abc` FROM `tablename` WHERE`username` LIKE '$username' LIMIT 0 , 30") or die(mysql_error()); $myfighter = mysql_fetch_assoc($fighter); echo "$myfighter['f_id']"; but it is displaying only one record how do id display all records which match this condition. can anyone tell me how to display all records at once Quote Link to comment Share on other sites More sharing options...
max_w1 Posted March 9, 2008 Author Share Posted March 9, 2008 i am really upset with you guys i finally found the answer myself. what i did is: $result = mysql_query ("SELECT `abc` FROM `tablename` WHERE`username` LIKE '$username' LIMIT 0 , 30") or die(mysql_error()); $myresult = mysql_fetch_assoc($result); while($myresult = mysql_fetch_assoc($result)) { echo $myresult['f_id']; } KEEP UP THE GOOD WORK OF NOT HELPING!!!! > Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted March 9, 2008 Share Posted March 9, 2008 It's Sunday in most of the time zones on earth right now, so the number of people even reading posts is very low. You need to have enough patients to wait at least two hours from your original post for a reply. Looping is a fundamental concept in all programming languages. Anyone who did read your post probably expected you to be able to figure out what the problem was. Your final code will end up with one missing row of data because you are fetching an extra row in the line of code before your loop. Quote Link to comment Share on other sites More sharing options...
fenway Posted March 10, 2008 Share Posted March 10, 2008 Not to mention that there's no column called 'f_id'. And expecting a solution in 2 hours in unreasonable. 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.