日期:2014-05-17 浏览次数:20537 次
<?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"); ?>