警告:mysql_fetch_array()要求参数1为resource,boolean给出

时间:2013-02-08 06:27:23

标签: mysql arrays warnings fetch

您好我收到此错误,sql查询正常,这是我的代码。

$query = "INSERT into members VALUES(NULL,'$fname','$sname','$gender','$status','$dob','$phone','$address','$email','$chapter','$join_date','$cell')";

$result = mysql_query($query,$connection) 
    or show_error();

    echo $result;

$new_member = array();
$new_member = mysql_fetch_array($result) 
    or die (mysql_error());
echo 'new_member =', $new_member;
mysql_close();
return $new_member;

}

1 个答案:

答案 0 :(得分:0)

必须删除变量附近的单引号,并且$ query应该是

“插入成员VALUES(NULL,$ fname,$ sname,$ gender,$ status,$ dob,$ phone,$ address,$ email,$ chapter,$ join_date,$ cell)”;