web 2.0

How to use PHP & Oracle (oci8) and Transaction (oci_rollback,oci_commit)

How to use PHP & Oracle (oci8) and Transaction (oci_rollback,oci_commit) This is the guideline/example scripts how to use PHP and Oracle on Transaction mode (oci_rollback,oci_commit)

ShotDev Focus:
- PHP & Oracle database and Transaction (oci_rollback,oci_commit).

Example

php_oracle_transaction.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?
$objConnect = oci_connect("myuser","mypassword","TCDB");

$strSQL = "";
$strSQL = "INSERT INTO CUSTOMER ";
$strSQL .="(CUSTOMERID,NAME,EMAIL,COUNTRYCODE,BUDGET,USED) ";
$strSQL .="VALUES ";
$strSQL .="('C005','Weerachai Nukitram','webmaster@shotdev.com','TH','6000000','0') ";
$objParse = @oci_parse($objConnect, $strSQL);
$objExecute = @oci_execute($objParse,OCI_DEFAULT);

if($objExecute)
{
oci_commit($objConnect);
echo "Record is Commit";
}
else
{
oci_rollback($objConnect);
$e = oci_error($objParse);
echo "Record is Rollback [".$e['message']."]";
}

oci_close($objConnect);
?>
</body>
</html>

.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1.00 out of 10)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.