mysqli_fetch_array()期望参数1是mysqli_result,布尔值在

我有一些麻烦,检查FB User_id是否已经存在于我的数据库(如果它不应该然后接受用户作为一个新的,否则只是加载canvas的应用程序)。 我在我的托pipe服务器上运行它,并没有问题,但在我的本地主机,它给了我以下错误:

mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in 

这是我的代码:

 <? $fb_id = $user_profile['id']; $locale = $user_profile['locale']; if ($locale == "nl_NL") { //Checking User Data @ WT-Database $check1_task = "SELECT * FROM `users` WHERE `fb_id` = " . $fb_id . " LIMIT 0, 30 "; $check1_res = mysqli_query($con, $check1_task); $checken2 = mysqli_fetch_array($check1_res); print $checken2; //If User does not exist @ WT-Database -> insert if (!($checken2)) { $add = "INSERT INTO users (fb_id, full_name, first_name, last_name, email) VALUES ('$fb_id', '$full_name', '$first_name', '$last_name', '$email')"; mysqli_query($con, $add); } //Double-check, User won't be able to load app on failure inserting to database if (!($checken2)) { echo "Excuse us " . $first_name . ". Something went terribly wrong! Please try again later!"; exit; } } else { include ('sorrylocale.html'); exit; } 

我读过它有一些与我的查询是错误的,但它已经在我的托pipe服务提供商,所以不能这样做!

该查询失败并返回false

把它放在mysqli_query()后面看看是怎么回事。

 if (!$check1_res) { printf("Error: %s\n", mysqli_error($con)); exit(); } 

了解更多信息:

http://www.php.net/manual/en/mysqli.error.php