如何防止PDO准备语句添加引号?

时间:2014-04-03 04:42:08

标签: php mysql pdo

我有PDO这样的查询。

$query=$this->con->prepare('SELECT ? FROM ? ');
$query->execute(array($rows,$table));
/*$rows="*"; $table="category";*/

编码中的一切都还可以。但是当PDO执行我的查询时,它将其解析为,

SELECT '*' FROM 'category'

所以这是一个错误的SQL语句。

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 ''category'' at line 1

请帮帮我。如何防止PDO插入'

0 个答案:

没有答案
相关问题