$dsn = "mysql:host=localhost;dbname=dbname";
$pdo = new PDO($dsn,"userpassword","password");
//查询
$sql = "SELECT * from tables where id > 1 limit 1";
$row = $pdo->query($sql);
$row = $row->fetchAll(PDO::FETCH_ASSOC);
//插入
$sql = "insert into table(tid,price) values(:tid, :price)";
$stmt = $pdo->prepare($sql);
$stmt->execute(array('35678', '100'));
//删除
$dbh->exec("delete from table where id = '1'");
标签:none