gpt4 book ai didi

php - 在 Codeigniter 中转义查询的正确方法

转载 作者:行者123 更新时间:2023-11-29 04:40:52 25 4
gpt4 key购买 nike

<分区>

$sql = ("update Inventory SET  ? = ?+1 WHERE ID= ?");

$query = $this->db->query($sql, array($field,$field,$id))->affected_rows();

错误:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''Upvotes' = 'Upvotes'+1 WHERE ID= 386464' at line 1

基本上它是在 Upvotes 字段周围添加引号,导致它成为格式错误的查询什么是删除单引号或完全重写查询的最实用方法?

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