My code looks fine but it is not working as it should because update statement is working. When I call this function my page loads without showing any errors on my screen.
public function update(){
global $database;
$attributes = $this->sanitized_attributes();
$attributes_pairs = array();
foreach($attributes as $key => $value){
$attributes_pairs[] = "{$key}='{$value}'";
}
$sql = "UPDATE ".static::$table_name." SET ";
$sql .= join(", ", $attributes_pairs);
$sql .= " WHERE id=".static::$i_d;
$database->query($sql);
return ($database->affected_rows() == 1)? true : false;
}
your code doesn’t look ok to me, the update with join is first JOIN and then SET, take a look to the documentation
or
In your case try to make join first and then try the “set” statement