<?php
$con = mysql_connect("localhost","root","root");
if (false == $con)
{
printf("%s,%s,%s\n",__FILE__,__FUNCTION__,__LINE__);
exit(1);
}
$ret = mysql_select_db("algoplat",$con);
if (false == $ret)
{
printf("%s,%s,%s\n",__FILE__,__FUNCTION__,__LINE__);
exit(1);
}
$ret = mysql_query("BEGIN",$con);
if (false == $ret)
{
printf("%s,%s,%s\n",__FILE__,__FUNCTION__,__LINE__);
exit(1);
}
$sql1 = "select * from taskstatus";
$sql2 = "insert into taskstatus (aid,did) values(100,100)";
$ret1 = mysql_query($sql1,$con);
$ret2 = mysql_query($sql2,$con);
if (false != $ret1 && false != $ret2)
{
mysql_query("COMMIT");
printf("%s,%s,%s:commit\n",__FILE__,__FUNCTION__,__LINE__);
}
else
{
mysql_query("ROLLBACK");
printf("%s,%s,%s:rollback\n",__FILE__,__FUNCTION__,__LINE__);
}
$row = true;
while(true)
{
$row = mysql_fetch_row($ret1);
if (false == $row)
{
break;
}
var_dump($row);
}
?>
$con = mysql_connect("localhost","root","root");
if (false == $con)
{
printf("%s,%s,%s\n",__FILE__,__FUNCTION__,__LINE__);
exit(1);
}
$ret = mysql_select_db("algoplat",$con);
if (false == $ret)
{
printf("%s,%s,%s\n",__FILE__,__FUNCTION__,__LINE__);
exit(1);
}
$ret = mysql_query("BEGIN",$con);
if (false == $ret)
{
printf("%s,%s,%s\n",__FILE__,__FUNCTION__,__LINE__);
exit(1);
}
$sql1 = "select * from taskstatus";
$sql2 = "insert into taskstatus (aid,did) values(100,100)";
$ret1 = mysql_query($sql1,$con);
$ret2 = mysql_query($sql2,$con);
if (false != $ret1 && false != $ret2)
{
mysql_query("COMMIT");
printf("%s,%s,%s:commit\n",__FILE__,__FUNCTION__,__LINE__);
}
else
{
mysql_query("ROLLBACK");
printf("%s,%s,%s:rollback\n",__FILE__,__FUNCTION__,__LINE__);
}
$row = true;
while(true)
{
$row = mysql_fetch_row($ret1);
if (false == $row)
{
break;
}
var_dump($row);
}
?>