php事务未成功,
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><?php
$conn = mysql_connect('localhost','root','123123') or die ("123!!!");
mysql_select_db('eshop',$conn);
mysql_query("set names 'GBK'"); //使用GBK中文编码;
?>
<?php
mysql_query("SET AUTOCOMMIT=0");
$sql = "INSERT INTO `basket` (`id`, `status`, `qty`) VALUES (NULL, 'test1', '0')";
$sql2 = "INSERT INTO `basket` (`isd`, `status`, `qty`) VALUES (NULL, 'test1', '0')";//这条我故意写错
$res = mysql_query($sql);
$res1 = mysql_query($sql2);
if($res && $res1){
mysql_query("COMMIT");
echo 'ss';
}else{
mysql_query("ROLLBACK");
echo 'dddd';
}
mysql_query("END");
?>
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号