摘要: try { $dsn = "mysql:host=127.0.0.1;port=3306;dbname=dab"; $pdo = new PDO($dsn, 'root', ''); $pdo -> setAttribute(PDO::ATTR_AUTOCOMMIT, false... 阅读全文
posted @ 2014-08-25 10:35 gabin 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 1、Select// DEMO mysqli连接方式参考$db = new mysqli("localhost:3306", "root", "", "dab"); // 简单查询//$result = $db -> query("select * from DAB_NTOS_ADMIN");//w... 阅读全文
posted @ 2014-08-25 10:26 gabin 阅读(281) 评论(0) 推荐(0) 编辑
摘要: PDO存在一个LIMIT BUG(mysql)需要指定数据类型,而且limit后面跟的2个参数必须是数值类型,不然的话获取不到数据例1:$dsn = "mysql:host=127.0.0.1;port=3306;dbname=dab"; $dbh = new PDO($dsn, 'root', '... 阅读全文
posted @ 2014-08-25 09:17 gabin 阅读(558) 评论(0) 推荐(0) 编辑
摘要: PDO =》 PHP DATABASE OBJECT1、Select$dsn = "mysql:host=127.0.0.1;port=3306;dbname=dbname"; $dbh = new PDO($dsn, 'root', 'password');$sql = "select * fro... 阅读全文
posted @ 2014-08-25 09:02 gabin 阅读(386) 评论(0) 推荐(0) 编辑