Hi guys,
I can't get passed this error: Call to a member function bind_param() on a non-object.
I have spent hours looking for insights, and can see that my $statement returns FALSE, but have no idea why?
My understanding of PHP is limited, so it might help if I actually understood what an object was???
I have tried the query straight into mysql and it works fine, so really can't understand why this doesn't work! My code is:
$datetime = new DateTime();
$datetime = $datetime->format('Y-m-d H:i:s');
$query = 'UPDATE vd_users set lastlogin WHERE facebook_id = '.$_SESSION['id'].' VALUES (?)';
$statement = $mySQL_con->prepare($query);
$statement->bind_param('s', $datetime);
try {
$statement->execute();
header('Location: #');
}
catch (mysqli_sql_exception $error) {
die ('Failed to update database');
}
}
Would really appreciate it if someone could help me out!