gpt4 book ai didi

php - SQL 语法错误,执行多个查询时?

转载 作者:搜寻专家 更新时间:2023-10-30 20:04:47 24 4
gpt4 key购买 nike

我正在使用现成的脚本通过 PHP 备份我的 MySQL 数据库。我将结果查询存储在一个变量中。

如果我回显该变量,并将输出复制粘贴到 MySQL 控制台,它会完美运行。

但是当我使用“mysql_query”运行相同的程序时(我知道它已贬值,请忽略它),我得到了可怕的语法错误。

这是回显输出(前两行):

INSERT INTO assign VALUES('75085','rsam','CE0001/CZ0001/CPE183/CSC183','1','1','3.0','13','1','1','13','2','10.00','117.00','0','0');INSERT INTO assign VALUES('75086','rsam','CE0001/CZ0001/CPE183/CSC183','1','2','3.0','13','1','1','13','2','10.00','97.50','0','0');

这是确切的错误:

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 'INSERT INTO assign VALUES('75085','rsam','CE0001/CZ0001/CPE183/CSC183','1','1'' at line 1

如果有人能指出我明显遗漏了什么,我将不胜感激!

最佳答案

作为 mysql_query() 的文档说:

mysql_query() sends a unique query (multiple queries are not supported) to the currently active database on the server that's associated with the specified link_identifier.

您可能对 mysql_multi_query() 感兴趣:

Executes one or multiple queries which are concatenated by a semicolon.

关于php - SQL 语法错误,执行多个查询时?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19330243/

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