I am having an issue with the function where it checks if a Facebook user id is there in the database or not. It works in the hosting server but gives an error in the local host.
mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in
My code:
<?
$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 the 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, the user won't be able to load the app on failure inserting to the database
if (!($checken2)) {
echo "Excuse us " . $first_name . ". Something went terribly wrong! Please try again later!";
exit;
}
} else {
include ('sorrylocale.html');
exit;
}
Can someone help me solve this issue?