Blogger Information
Blog 61
fans 0
comment 0
visits 53927
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PDO练习3
笑颜常开的博客
Original
579 people have browsed it

<?php
$pdo=new PDO('mysql:host=127.0.0.1;dbname=php','root','root');
$sql='update `staff` set `position`=:position where `id`=:id';
$stmt=$pdo->prepare($sql);
//$stmt->bindValue('position','文化馆长',PDO::PARAM_STR);
//$stmt->bindValue('id',6,PDO::PARAM_INT);
$stmt->execute(['position'=>'小学校长','id'=>10]);
if ($stmt->rowCount() > 0) {
   echo '成功的更新了' . $stmt->rowCount() .  '条记录';
}
$pdo=null;

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post