I'm trying to update user data, but the active field is not updated.
I have tried several changes and also changed the value of the variable $active
from boolean
to int
, but without success.
Another behavior I noticed is when I do not make any changes to the fields and I have to execute the update, $stmt->affected_rows
returns 0, is this normal?
public function user_update($user_id, $name, $email, $active)
{
$stmt = $this->conn->prepare("UPDATE users SET user_name = ?, user_email = ?, user_active = ? WHERE user_id = ?");
$stmt->bind_param("ssbi", $name, $email, $active, $user_id);
$stmt->execute();
$num_affected_rows = $stmt->affected_rows;
$stmt->close();
return $num_affected_rows > 0;
}
The version of php
is 5.6.22, and the base is MySQL