Jump to content

I'm getting an "invalid argument" error for my While loop....


Jim R

Recommended Posts

I'm getting an invalid argument error for my While loop.  I can't figure out why. 

 

$sql="SELECT * FROM schools ORDER BY class DESC,sectional ASC,team ASC";

$results = mysql_query($sql);

while ($team = mysql_fetch_assoc($results)) {

echo $team['school'] . '<br>';

}

 

 

Here is the error:

 

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/******/public_html/hoosierhoopsmagazine.com/resources/sectional_assignments.php on line 7

okay i don't think you're understanding.. lets try something more simple..

 

$sql="SELECT * FROM schools ORDER BY class DESC,sectional ASC,team ASC";

$results = mysql_query($sql) or die(mysql_error());

while ($team = mysql_fetch_assoc($results)) {

echo $team['school'] . '<br>';

}

I am understanding.  I put the exact code Adam told me to put, and that was what it produced, which is what I posted in the response above.

 

Yeah sorry for the confusion, I missed out E_USER_ERROR for the second parameter. If you didn't see the MySQL error though it's likely you have warning messages hidden.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.