简体   繁体   中英

which PDO::PARAM_* to use with a SET() datatype?

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 v 0 ,v 1 ,v x 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() ).

PARAM_STR should do the job correctly. It will escape values and add single quotes around comma separated list.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM