131
131

Reputation: 1385

Problems with mysql_fetch_array

So i'm having trouble using mysql_fetch_array. this is my code:

$sql=mysql_query("SELECT * FROM members WHERE group='$group'");
$query=mysql_fetch_array($sql);

i am getting the following error:

Warning: mysql_fetch_array() expects parameter 1 to be resource

Any help would be very appricated

Upvotes: 0

Views: 63

Answers (1)

131
131

Reputation: 1385

group is a mysql function, you must enclose it with ` so mysql know that it's a name and not the function. like this:

$sql=mysql_query("SELECT * FROM members WHERE `group`='$group'");
$query=mysql_fetch_array($sql);

Upvotes: 3

Related Questions