Blogger Information
Blog 48
fans 0
comment 0
visits 36386
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
pdo删除数据-2018.08.30
雨天的博客
Original
692 people have browsed it

实例

<?php
/**
 * 删除数据
 */
$pdo = new PDO('mysql:host=localhost;dbname=data','root','root');
$sql = "delete from stu where id = :id";
$stmt = $pdo->prepare($sql);
if($stmt->execute(['id'=>5]))
{
    echo '<h3>成功删除'.$stmt->rowCount().'条</h3>';
}else
{
    echo '<h3>删除失败</h3>';
    print_r($stmt->errorInfo());
    exit;
}

运行实例 »

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


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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!