错误 mysql_query() 期望参数 1 为字符串
error mysql_query() expects parameter 1 to be string
$insertData = ("INSERT INTO facebook (fdId, fullName, ,email, dob, location, gender, postId)
VALUES ('$fbId','$fullName','$email','$new_date','$location','$gender','$postId')");
if(! $vdb )
{
die('Could not connect: ' . $vdb());
}
echo 'Connected successfully';
mysql_select_db('noskunk1_facebook',$vdb);
mysql_query($insertData);
if (mysql_query($vdb, $insertData)) {
echo "New record created successfully";
} else {
echo "Error: " . $insertData . "<br>" . mysql_error($vdb);
}
mysql_free_result($vdb);
我可以看到任何问题,我已经做了很多时间,但我根本无法解决这个问题
得到错误mysql_query() expects parameter 1 to be string
您的查询应如下所示:
$insertData = "INSERT INTO facebook (fdId, fullName, email, dob, location, gender, postId)
VALUES ('".$fbId."','".$fullName."','".$email."','".$new_date."','".$location."','".$gender."','".$postId."')";
mysql_select_db('noskunk1_facebook',$vdb);
$result = mysql_query($insertData);
if ($result)) {
echo "New record created successfully";
} else {
echo "Error: " . $insertData . "<br>" . mysql_error($vdb);
}
但考虑使用 pdo
$insertData = ("INSERT INTO facebook (fdId, fullName, ,email, dob, location, gender, postId)
VALUES ('$fbId','$fullName','$email','$new_date','$location','$gender','$postId')");
if(! $vdb )
{
die('Could not connect: ' . $vdb());
}
echo 'Connected successfully';
mysql_select_db('noskunk1_facebook',$vdb);
mysql_query($insertData);
if (mysql_query($vdb, $insertData)) {
echo "New record created successfully";
} else {
echo "Error: " . $insertData . "<br>" . mysql_error($vdb);
}
mysql_free_result($vdb);
我可以看到任何问题,我已经做了很多时间,但我根本无法解决这个问题
得到错误mysql_query() expects parameter 1 to be string
您的查询应如下所示:
$insertData = "INSERT INTO facebook (fdId, fullName, email, dob, location, gender, postId)
VALUES ('".$fbId."','".$fullName."','".$email."','".$new_date."','".$location."','".$gender."','".$postId."')";
mysql_select_db('noskunk1_facebook',$vdb);
$result = mysql_query($insertData);
if ($result)) {
echo "New record created successfully";
} else {
echo "Error: " . $insertData . "<br>" . mysql_error($vdb);
}
但考虑使用 pdo