imarockstar Posted October 7, 2009 Share Posted October 7, 2009 I have a website that has a DB of alot of rock venues in the usa .. I need to display all the venues sorted out by there state ... in each state i need to have all the venues of that state listed ... the code i have (that is not working) is : <?php $sql="SELECT * FROM venues WHERE vstate != '' GROUP BY vstate "; $result=mysql_query($sql); // Start looping rows in mysql database. while($rows=mysql_fetch_array($result)){ ?> <? echo $rows['vname']; ?> - <? echo $rows['vstate']; ?><bR> <?php $sql2="SELECT * FROM venues WHERE vstate = ".$rows['vstate']." "; $result2=mysql_query($sql2); // Start looping rows in mysql database. while($rows2=mysql_fetch_array($result2)){ ?> <? echo $rows2['vname']; ?> *** <br> <?php } ?> <? } ?> the error I am getting is this : Last Supper Club - WA Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/tourzag/public_html/view_venues.php on line 37 Cafe Du Nord - CA Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/tourzag/public_html/view_venues.php on line 37 Great Scott - MA Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/tourzag/public_html/view_venues.php on line 37 the machine shop - MN Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/tourzag/public_html/view_venues.php on line 37 Halligans - SC Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/tourzag/public_html/view_venues.php on line 37 Club Dada - TX Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/tourzag/public_html/view_venues.php on line 37 Club Mantra - WA Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/tourzag/public_html/view_venues.php on line 37 looks like it is displaying 1 venue from each state but wont list the other venues of that state .. any ideas ? Link to comment https://forums.phpfreaks.com/topic/176862-record-display-issue/ Share on other sites More sharing options...
itaym02 Posted October 7, 2009 Share Posted October 7, 2009 Echo the sql one line before you run it. Take that string and run it manually on the DB (easiest in the SQL panel of phpmyadmin). I guess this will show you the real error. Link to comment https://forums.phpfreaks.com/topic/176862-record-display-issue/#findComment-932555 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.