gpt4 book ai didi

php - 代码点火器插入语法错误

转载 作者:行者123 更新时间:2023-11-29 05:31:48 27 4
gpt4 key购买 nike

这是我插入的sql语句:

$sql = "
LOCK TABLE notre_offre WRITE;

SELECT
@myRight := rgt FROM notre_offre
WHERE id = " . $this->input->post('category') . ";

UPDATE notre_offre SET rgt = rgt + 2 WHERE rgt > @myRight;
UPDATE notre_offre SET lft = lft + 2 WHERE lft > @myRight;
INSERT INTO notre_offre(id, naziv, lft, rgt) VALUES(null, '" . $this->input->post('title') . "', @myRight + 1, @myRight + 2);
UNLOCK TABLES;
";

$query = $this->db->query($sql);

但是我遇到了语法错误:

"Error Number: 1064

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 'SELECT @myRight := rgt FROM notre_offre WHERE id = 2; UPD' at line 3

这是什么问题?这在 phpmyadmin 和 cmd 中完美运行。"

最佳答案

不具体了解 Codeigniter,但您可能无法一次性发送多个 SQL 命令。尝试通过单独的 query() 调用发送单独的 LOCKSELECT 等命令。

关于php - 代码点火器插入语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14076987/

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