<?php
$pdo=new PDO('mysql:host=localhost;dbname=student','root','root');
try{
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->beginTransaction();
## //第1條sql語句
$sqla="delete from chen where id=14";
$pdo->exec($sqla) ;
//第2天sql語句
$sqlb="delete froms chen where id=15"; //故意把from寫錯
$pdo->exec($sqlb);
#}catch(Exception $e){
$pdo ->rollBack();
$e->getMessage();
echo "操作失敗";
}
?>
資料庫引擎是不是MyISAM,改成InnoDB試試看