PHP PDO 显示一些莫名其妙的行为。参数占位符被替换为相同的值。
$查询
UPDATE `newsletters` SET `title` = :title , `scheduled` = :scheduled , `modified` = :modified WHERE `id` = :id
$参数
Array
(
[:title] => New Newsletter22
[:scheduled] => 2013-04-15 21:47:00
[:modified] => 2013-04-15 21:47:51
[:id] => 35
)
功能
public static function execute($query=null,$parameters=array())
{
global $dbnew;
$statement= $dbnew->prepare($query);
foreach($parameters as $k=>$v){
if(is_array($v)){
$statement->bindParam($k, $v[0],$v[1]);
}else{
$statement->bindParam($k, $v);
}
}
$statement->execute();
return $statement;
}
执行查询
1132 Query UPDATE `newsletters` SET `title` = '35' , `scheduled` = '35' , `modified` = '35' WHERE `id` = '35'