Twister1004 Posted December 7, 2008 Share Posted December 7, 2008 Hey, another crises im facing. Objective: I have about 61 songs in my database and I want it to come out in the form of a TABLE. However, I keep getting massive errors, and I don't understand how to fix it. It could be because im not experienced enough and never delt with it. Error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\Documents and Settings\Compaq_Owner\Desktop\Server Files\XAMPP\xampp\htdocs\songs.php on line 38 It also just keeps on going on and on acting like the Loop will never end. code: $sel = 'SELECT DISTINCT `id`, `song`, `artist` FROM `music`'; $sel2 = mysql_query($sel) or die("WTH! " . mysql_error()); $get = mysql_fetch_row($sel2); while (mysql_num_rows($get) <= 61){ ++$get; echo "<table><tr><td>" . $get[0] . "</td><td> " . $get[1] . "</td><td> " . $get[2] . "</td></tr></table>"; } Any hints tips posts (You know the drill) Thanks =D Link to comment https://forums.phpfreaks.com/topic/135881-solved-getting-61-rows-in-a-table-and-getting-them-all/ Share on other sites More sharing options...
dclamp Posted December 7, 2008 Share Posted December 7, 2008 instead of explaining what you did wrong, i just fixed it... $sel = 'SELECT * FROM `music`'; $sel2 = mysql_query($sel) or die("WTH! " . mysql_error()); while ($get = mysql_fetch_array($sel2)){ echo "<table><tr><td>" . $get[0] . "</td><td> " . $get[1] . "</td><td> " . $get[2] . "</td></tr></table>"; } Hope that helps, i am to tired to write out an explanation. Link to comment https://forums.phpfreaks.com/topic/135881-solved-getting-61-rows-in-a-table-and-getting-them-all/#findComment-708325 Share on other sites More sharing options...
Twister1004 Posted December 7, 2008 Author Share Posted December 7, 2008 NEVER MIND! I just realized you made a variable inside the while statement O_o. Didn't know that was possible. Edit2: Is there any way where I can make it into a table when it gets it out of the database? Also thank you dclamp. Link to comment https://forums.phpfreaks.com/topic/135881-solved-getting-61-rows-in-a-table-and-getting-them-all/#findComment-708327 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.