这三个东西怎么搭配使用呢

WBOY
Release: 2016-06-13 12:10:07
Original
1043 people have browsed it

这三个东西如何搭配使用呢

本帖最后由 php_cdsn2 于 2014-11-17 11:21:50 编辑 $_mysqli->rollback();
$_mysql->atuocommit();
InnoDB如何使用
------解决思路----------------------
一个小例子
<br />	$mysqli=new mysqli("localhost","root","123456","test");<br /><br />	if($mysqli->connect_error){<br />		die($mysql->connect_error);<br />	}<br />	//将提交设为 false(一旦提交,无法回滚)<br />	$mysqli->autocommit(false);<br />	//保存点 ,把当前记录保存<br />	$sql1="update account set balance=balance-1 where id=1";<br />	$sql2="update account set balance=balance+1 where id=2";<br /><br />	$b1=$mysqli->query($sql1);<br />	$b2=$mysqli->query($sql2);<br /><br />	if(!$b1<br><font color='#FF8000'>------解决思路----------------------</font><br>!$b2){<br />		//回滚<br />		$mysqli->rollback();<br />		echo "失败--".$mysqli->error;<br />	}else{<br />		//提交<br />		$mysqli->commit();<br />		echo "成功";<br />	}<br /><br />	$mysqli->close();<br />
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template