Blogger Information
Blog 60
fans 0
comment 1
visits 37607
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PDO删除操作-4月26
威灵仙的博客
Original
513 people have browsed it

实例

<?php
/**
 * 简化预处理更新数据
 */

//1.连接数据库,创建pdo对象
$pdo = new PDO('mysql:dbname=php','root','root');

//2.创建预处理语句对象

$stmt = $pdo->prepare("DELETE FROM staff  WHERE user_id=7");
//3.将参数绑定到预处理语句对象并执行

$stmt -> execute(['user_id'=>7]);
echo '成功删除了'.$stmt->rowCount().'条记录';

运行实例 »

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


Correction status:qualified

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