Thursday 11 January 2018

PHP & MySQLi Fatal error: Call to a member function bind_param() on a non-object

I'm facing this problem and I've searching for hours
now..
I can't see any problem in this piece of code... What's wrong
here?



db.php:



$mysqli
= mysqli_connect('localhost', 'root', '',
'site');

if(mysqli_connect_errno())
{
echo
"Erro BD";
exit();

}
?>


update.php:




include
'db.php';

$zzz = '';
$email =
'asdsaf@gmail.com';

$ins = $mysqli->prepare("update USER set
cod_valida =? where email =?");
$ins->bind_param('ss', $zzz,
$email);

if ($result =
$ins->execute()){


$ins->free_result();

echo "It works";
}
else
{
echo
"Error";

}
$ins->close();
$mysqli->close();



Is
there anyway to echo the query I'm trying to send or the mysql
error?



Thank you for your help instead of
downvote my thread since I already checked everything and found no
answer.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...