gpt4 book ai didi

php - MySQL:使用准备好的语句从表中删除两列

转载 作者:行者123 更新时间:2023-11-29 06:07:57 26 4
gpt4 key购买 nike

我正在尝试更新两列而不删除整行。这是我正在使用的:

$sql='update users set token='',timestamp='' where token=?';
$stmt=$db_con->stmt_init();
$stmt->prepare($sql_3);
$stmt->bind_param('s',$token);
$stmt->execute();

但是,它给了我这个错误:T_CONSTANT_ENCAPSED_STRING。现在,当我通过 MySQL CLI 作为 update users set token='',timestamp='' where token='blahblah'; 使用它时,查询工作正常,我该如何解决这个问题?

最佳答案

使用这个

$sql="update users set token='',timestamp='' where token=?";

您可以在此处找到有关如何转义字符串的更多信息。
http://php.net/manual/en/language.types.string.php

关于php - MySQL:使用准备好的语句从表中删除两列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10581975/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com