mysql - How to add a colon to front of each string in array php pdo -


i writing pdo loop create number of mysql statement. pdo formating requires colon in front of column names.

before:

(cryptokeys, domains, records) 

after:

(:cryptokeys, :domains, :records) 

what php function can use put colon in front of each element in foreach loop?

you can loop through array , add :

foreach ($array &$value)     $value = ':'.$value; 

also array_walk can used well

array_walk($array, function(&$value) { $value = ':'.$value; }); 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -