mySQLi prepared UPDATE statement

2019-09-07 00:38发布

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
0条回答
登录 后发表回答