Why error occurs when I send multiple queries into mysqli_query?

删除回忆录丶 提交于 2019-11-29 13:07:56

You are supposed to run your queries with separate API calls.

$DB->query("INSERT INTO ...");
$DB->query("SET @lastID = LAST_INSERT_ID()");
$DB->query("INSERT INTO ...");

note that you don't actually need the second query here as LAST_INSERT_ID() can be used directly.

Besides, you should never use a function named "HTML speacial chars" for any database interaction. You have to use prepared statements instead.

Note that a suggestion to use multi_query is unjustified and misleading, causing a lot of problems.

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