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