I have an assoc array filled with the values necessary for a PDOstatement. Should I, bind each value then call execute? Or call execute passing it the array of values?
Array(
[name] => Joe
[value] => some content
)
Should I:
foreach($data as $key => $value){
$statement->bindValue($key, $value);
}
execute();
OR
execute($data);
As far as I am aware, binding the data does some form of data sanitation similar to mysql_real_escape_string
. I am uncertain whether I need to bind the values to achieve that affect or if I can just pass the data array to execute() and assume it has been properly escaped?