删除数据库中相关信息

  1. 作者QQ:67065435 QQ群:821635552

  2. 本站内容全部为作者原创,转载请注明出处!

  3. 示例代码 ```php <?php //ext:pdo //ext:pdo_mysql

    最简单的方式执行(exec返回受影响行数)

    $dbh = new PDO('mysql:dbname=book_base;host=192.168.1.137', 'root', 'root'); $dbh->exec("set names utf8"); $sql = <<exec($sql); unset($dbh);

按序绑定参数执行(execute返回执行bool结果)

$dbh = new PDO('mysql:dbname=book_base;host=192.168.1.137', 'root', 'root'); $dbh->exec("set names utf8"); $sql = <<prepare($sql); $sth->bindValue(1, 10000); $sth->bindValue(2, 10086); $sth->bindValue(3, 95001); $res = $sth->execute(); unset($sth); unset($dbh);

按key绑定参数执行(execute返回执行bool结果)

$dbh = new PDO('mysql:dbname=book_base;host=192.168.1.137', 'root', 'root'); $dbh->exec("set names utf8"); $sql = <<prepare($sql); $sth->bindParam('id', $id); $res = $sth->execute(); unset($sth); unset($dbh); ```

Copyright © 豆包嘿嘿~ 2012-∞ 冀ICP备17033181号 all right reserved,powered by Gitbook修订: 21-07-07 12:25

results matching ""

    No results matching ""