27CDruid Posted November 28, 2008 Share Posted November 28, 2008 I desperately need a variety of help with PHP. Currently im trying to pull a list of songs from a database (made in MyPHPAdmin). I have a problem with getting any output whatsoever and any example html/php code of this would be brilliant. So far (it doesnt work at all) i have: <?php ... $dbQuery="SELECT SongID, Track, Artist, Album, Downloads FROM song " . " ORDER BY Downloads ASC "; $result=mysql_query($dbQuery, $db); while ($dbRow=mysql_fetch_array($result)) { $track=$dbRow[“Track”]; echo "Name is $track <br> "; } ?> <html> <head> <title>New Releases</title> <link rel="stylesheet" href="contactStyles.css"> </head> <body> <table class="border" align="left" width="400" cellspacing="0" cellpadding="5" style="height: 266px"> <tr><th class="style3">The tops tracks are:</th></tr> <tr><td> <form action="toptracks.php" method="post"> <table width="100%" cellpadding="3" cellspacing="5" border="0"> <tr><td align="center"> <font face="verdana" color="navy"> "$track"</font><br> </td></tr> </table> </body> </html> Link to comment https://forums.phpfreaks.com/topic/134651-need-phpsql-help-or-ill-fail/ Share on other sites More sharing options...
27CDruid Posted November 28, 2008 Author Share Posted November 28, 2008 Will tap dance for help. Link to comment https://forums.phpfreaks.com/topic/134651-need-phpsql-help-or-ill-fail/#findComment-701117 Share on other sites More sharing options...
27CDruid Posted November 28, 2008 Author Share Posted November 28, 2008 Either i posted it in the wrong place, no one understands or no one wants to answer. Ill look elsewhere. Link to comment https://forums.phpfreaks.com/topic/134651-need-phpsql-help-or-ill-fail/#findComment-701151 Share on other sites More sharing options...
revraz Posted November 28, 2008 Share Posted November 28, 2008 Wrong place, has nothing to do with Math. And you give up after an Hour? You know it's the day after Thanksgiving right? If you get no output with that code, then you have an error. Display errors and turn error reporting on and post the error. Unless you're already gone, if so, cya. Link to comment https://forums.phpfreaks.com/topic/134651-need-phpsql-help-or-ill-fail/#findComment-701159 Share on other sites More sharing options...
27CDruid Posted November 28, 2008 Author Share Posted November 28, 2008 Im from ireland and we dont have thanksgiving over here. Didnt even realise it was yesterday. As for giving up my deadline is approaching (5hours) and things need to start working soon or ill never get it all finished. Link to comment https://forums.phpfreaks.com/topic/134651-need-phpsql-help-or-ill-fail/#findComment-701163 Share on other sites More sharing options...
.josh Posted November 28, 2008 Share Posted November 28, 2008 change to: $result=mysql_query($dbQuery, $db) or die(mysql_error()); Though I already suspect that you're using the wrong variable for the 2nd mysql_query argument. People usually assign mysql_select_db to $db. The 2nd argument to mysql_query (which is optional, btw) should be the connection resource (the variable you assigned mysql_connect to). Link to comment https://forums.phpfreaks.com/topic/134651-need-phpsql-help-or-ill-fail/#findComment-701345 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.