mySQLi prepared UPDATE statement

梦想的初衷 提交于 2019-12-11 18:37:51

问题


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.

来源:https://stackoverflow.com/questions/25172398/mysqli-prepared-update-statement

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!