I get this error:
Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in
In my code, I have:
// Perform it
$result = mysqli_query($connection, $query);
if ($result) {
// Success
echo "<h1>Uploaded results to database</h1>";
} else {
echo "FAILURE: Couldn't perform query on database: " . mysqli_error($connection);
}
// Release
mysqli_free_result($result);
Most other solutions I have read say it is because the query might have failed, but that is not the case, because I test the returned data from the query to see if it exists, and it does, so the <h1> tag gets executed. How come I can't release it then? I thought I should always released returned data when I was done working with it?