Blogger Information
Blog 15
fans 0
comment 0
visits 10441
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PDO删除操作2019.2.25
ken的博客
Original
711 people have browsed it

实例

<?php
//删除操作
//1.连接数据库

$pdo = new PDO('mysql:host=127.0.0.1;dbname=php;','root','root');

//2.执行操作

$sql = 'DELETE FROM `staff` WHERE `id`=:id ';//语句模板
$stmt=$pdo->prepare($sql);
//$stmt->bindValue('id','13',PDO::PARAM_INT);
$stmt->execute(['id'=>'13']);

if($stmt->rowCount()>0){
    echo '成功删除'.$stmt->rowCount().'条记录';
}
//3.关闭数据库连接

$pdo = null ;

运行实例 »

点击 "运行实例" 按钮查看在线实例

Correction status:Uncorrected

Teacher's comments:
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