Lamez Posted October 2, 2008 Share Posted October 2, 2008 ok I posted here yesterday (http://www.phpfreaks.com/forums/index.php/topic,219037.0.html). Well I took one of the poster advice, and decided that was a better, and cleaner way to organize the DB. However, I tried it, and I am having problems pulling it out of the database. here is my error: 1. Atlantic Coast Conference, Bonston College Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /mounted-storage/home48c/sub007/sc33591-LWQU/picks_web/all.php on line 10 Here is line 10: <?php while ($q = mysql_fetch_array($q)){ ?> here is the whole code: <?php $path = ""; $title = "All Football Teams in DB"; $rank = "yes"; include ($path."main/include/cons/head.php"); $q = mysql_query("SELECT * FROM `foot_teams`"); while ($q = mysql_fetch_array($q)){ $num += 1; $team = $q['confer'].', '.$q['team']; echo $num.'. '.$team; } include ($path."main/include/cons/foot.php"); ?> Now it has been a while since I have done anything with PHP or MySQL, so please do not "flame" me, or call me a noob, which I am. Thanks Guys! Quote Link to comment https://forums.phpfreaks.com/topic/126703-solved-mysql_fetch_array-problems/ Share on other sites More sharing options...
.josh Posted October 2, 2008 Share Posted October 2, 2008 you can't perform a mysql_fetch_array on the result source, because it will overwrite your result source. Use a diff var in your while loop Quote Link to comment https://forums.phpfreaks.com/topic/126703-solved-mysql_fetch_array-problems/#findComment-655305 Share on other sites More sharing options...
Lamez Posted October 2, 2008 Author Share Posted October 2, 2008 thank you so much! It makes so much sense now. Quote Link to comment https://forums.phpfreaks.com/topic/126703-solved-mysql_fetch_array-problems/#findComment-655313 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.