mySQLi prepared UPDATE statement

2019-09-07 01:03发布

问题:

I seem to have an odd issue with my prepared update statement. I am performing an update operation as follows:

$stmt = $db->prepare("UPDATE table SET id = ? WHERE email = ?");
$id = "test";
$email = "m@m.com"; 
$stmt->bind_param('ss', $id, $email);
$stmt->execute();

The update works, in terms of adding "test" as the id in the database. However, it adds test to EVERY row that has an email value, not just the row that has the value of "m@m.com" as I intended. Am I doing something blatantly wrong? There is no other code in the script.

标签: mysqli set where