Sqlite conn.php

try {
$dbh = new PDO(‘sqlite:xiaokyun.sqlite’);
$dbh->exec("CREATE TABLE xiaokyun(id integer primary key AUTOINCREMENT,
xiaokyun varchar(233) NOT NULL UNIQUE,
info varchar(233) default ‘xiaokyun’)");
$dbh->exec("INSERT INTO xiaokyun(xiaokyun, info) values(‘http://www.xiaokyun.com/’, ‘xiaokyun’)");
$dbh->beginTransaction();
$sth = $dbh->prepare(‘SELECT * FROM xiaokyun’);
$sth->execute();
$result = $sth->fetchAll();
print_r($result);
$dbh=null;
}
catch (PDOException $e){
echo ‘Connection failed: ‘ . $e->getMessage();
$dbh=null;
}

Published by

@XiaoKyun

双鱼男,过分热心的好人。