tags:

views:

27

answers:

1

I'm trying to make a simple mysql_fetch_array but for some reasons I get the error

"Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\get.php on line 5"

$sql = mysql_query("SELECT * FROM mxc WHERE exp_year > 2009 AND status=0 GROUP BY c_number");

 while($row = mysql_fetch_array($sql))
{
....

Any idea what's wrong with my code ? thanks in advance for any help !

+4  A: 

Chances are you have a mysql error. Change your query line to this:

$sql = mysql_query("SELECT * FROM mxc WHERE exp_year > 2009 AND status=0 GROUP BY c_number") or trigger_error(mysql_error());

And see what output you get.

Amber