1 require 'connect.php'; 2 $linshi = $dbh->prepare('UPDATE `category` SET `name` = :name, `alias`=:alias WHERE `cate_id` = :cate_id '); 3 if($linshi->execute(['name'=>"999",'alias'=>"8888",'cate_id'=>13])){ 4 if($linshi->rowCount()>0){ 5 echo "ok".$dbh->lastInsertId(); 6 } 7 }
预处理对象的字段名后面跟着的“预处理变量”,要和字段名一致