try {
$dbh = new PDO('mysql:host=localhostdbname=test', $user, $pass)
foreach($dbh->query('SELECT * from FOO') as $row) {
print_r($row)
}
$dbh = null//释放资源
} catch (PDOException $e) {
print "错误!: " . $e->getMessage() . "<br></br>"
die()
}
//执行删除 *** 作,插入、修改与此类似,更改SQL语句即可
$count = $dbh->exec("DELETE FROM fruit WHERE colour = 'red'")
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)