PDO:使用准备好的语句进行选择将返回列名 [英] PDO : Select using a prepared statement returns column name
本文介绍了PDO:使用准备好的语句进行选择将返回列名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
伙计们,请问这是否可行,也许我没有做正确的事.
Hey guys, question if this is possible or not, maybe I'm not doing something right.
我正在尝试使用准备好的语句来准备列
I'm trying to use a prepared statement where the column is prepared
即
SELECT ? FROM users
现在,如果我放了,这通常可以工作
Now this normally works if I put
SELECT id FROM users
但是在执行第一条语句时,值是列名.
But doing the first statement, the value is the column name.
id = id
0 = 0
id = id
0 = 0
我在做什么错了,或者这可能吗?
What am I doing wrong, or is this possible?
谢谢
推荐答案
否,您不能绑定列名或表名.
No you can't bind column names or table names.
更多信息在PDO语句中转义列名
这篇关于PDO:使用准备好的语句进行选择将返回列名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文