Wednesday, December 26, 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

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...