I'm having some issues with this MYSQL staement for updating a value [foodie_count=foodie_count-8] in one table [users] while having the value [food.id=?] from another table [food] and both tables are linked [users.id=food.userid]:
require_once('./includes/connection.inc.php');
$stmt = $db->prepare("UPDATE users SET foodie_count=foodie_count-8 FROM food INNER JOIN users ON users.id=food.userid WHERE food.id=?");
$stmt->bind_param('i',$delete_event);
$stmt->execute();
The statement is not proper and throwing me a fatal error of a call to a member function prepare() on a non-object.
I looked at some other posts, but don't specifically see where I error in writing the statement. Thanks.