哪个 PDO::PARAM_* 与 SET() 数据类型一起使用?
我有一个值数组,其中一个值是另一个数组(见下文)。我将内部数组内爆,使其变为 v0,v1,vx 并将其插入到 a 的列中mysql 数据库,其中数据类型为 SET()
a = array(
"first"=>"foo",
"second"=>array("b","a","r"), // this becomes "second"=>"b,a,r",
"third"=>"bang"
)
我的问题是我应该使用哪个 PDO::PARAM_*
?
(最初我会想到 PARAM_STR
,但我不确定 PDO 是否会执行一些无法与 SET()
配合使用的操作)。
I have an array of values, and one of the values is another array (see below). I implode the inner-array so that it becomes v0,v1,vx and I'm inserting it into a column of a mysql database where the datatype is SET()
a = array(
"first"=>"foo",
"second"=>array("b","a","r"), // this becomes "second"=>"b,a,r",
"third"=>"bang"
)
My question is which PDO::PARAM_*
should I use?
(Initially I would think PARAM_STR
, but I'm not sure if PDO will do something that won't work with SET()
).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
PARAM_STR
应该正确完成这项工作。它将转义值并在逗号分隔列表周围添加单引号。PARAM_STR
should do the job correctly. It will escape values and add single quotes around comma separated list.