为什么这条sql语句在命令行可以执行,但是在php的PDO会出错?

Yes
  • 1
新手上路,请多包涵

为什么这条sql语句在命令行可以执行,但是在php的PDO会出错?

SQL语句

SET @skip = 0; SET @numrows = 3;PREPARE stmt3 FROM 'SELECT * FROM post LIMIT ?, ?';EXECUTE stmt3 USING @skip, @numrows;

错误信息

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SET @numrows = 3;PREPARE stmt3 FROM 'SELECT * FROM post LIMIT ?, ?';EXECUTE s...' at line 1

回复
阅读 562
1 个回答

特殊字符记得加转义符,php我不大了解,但是之前做过别的,单引号,&都要加转义\

宣传栏