try {
$dsh=new PDO($dsn, $user, $password);
$dsh->query("set names utf8");
$dsh->beginTransaction();
$dsh->exec("insert into userinfo (uname,upwd,email) values ('呵呵','123','[email protected]')");
}catch(PDOException $e)
{
echo $e->getMessage();
$dsh->rollBack();
}
就是我这边不管有没有加$dsh->commit();这句话,他都会往数据库插入记录,这是为什么PDO事务数据库EmailUTF-8
$dsh=new PDO($dsn, $user, $password);
$dsh->query("set names utf8");
$dsh->beginTransaction();
$dsh->exec("insert into userinfo (uname,upwd,email) values ('呵呵','123','[email protected]')");
}catch(PDOException $e)
{
echo $e->getMessage();
$dsh->rollBack();
}
就是我这边不管有没有加$dsh->commit();这句话,他都会往数据库插入记录,这是为什么PDO事务数据库EmailUTF-8
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货