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 Quote Link to comment 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. Quote Link to comment 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. 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.