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>