Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in on line 78
This is my first time using MYSQLI and i followed and example I found on procedural coding and it always returns this
error. I looked on the php manual online and their examples seem to be coded like this as well. Does anyone know how
I can correct this issue?
I connect to the db successfully.
$link = mysqli_connect(DB_HOST, DB_USER,DB_PASS,DB_NAME);
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
Then I make the INSERT statement and run the query successfully
$players_query = "INSERT INTO `players` (id_players,player_name,player_id,clan_id,created_at,clan_name,clan_role,clan_member_since,data_updated_at)
VALUES ('','$player_name',$player_id,$clan_id,$created_at,'$clan_name','$clan_role',$clan_member_since,$updated_at)
ON DUPLICATE KEY UPDATE clan_id =$clan_id ,clan_role = '$clan_role',data_updated_at =$updated_at";
$result = mysqli_query($link,$players_query);
Then I verify the query ran and try to free results before the next query.
if($result){
echo "Player Information Updated Successfully";
mysqli_free_result($result);
}else{
printf("Errormessage: %s\n", mysqli_error($link));
die();
}
Then I get this:
Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in on line 78