note 14173 deleted from ref.oci8 by sixd

From: Date: Wed, 09 Dec 2009 00:49:55 +0000
Subject: note 14173 deleted from ref.oci8 by sixd
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-163727@lists.php.net to get a copy of this message
Note Submitter: doug at redhive dot com ---- if you feel like you have too many oracle statements clouding up your php, i came up with a function to open a connection (if necessary), parse your sql statement, and return the executed query. after you call the function, you can do whatever needs to be done. makes like so much simpler: (do whatever you want with the errors) function execute_query($query, &$connected) { global $ORACLE_USER, $ORACLE_PASS, $ORACLE_SID; if(!$connected) { $connected = @OCIPLogon($ORACLE_USER, $ORACLE_PASS, $ORACLE_SID); if($error = OCIError()) { die("<font color=red>ERROR!! Couldn't connect to server!</font>"); } } $stmt = @OCIParse($connected, $query); if($error = OCIError($cn)) { die("<font color=red>ERROR!! Statement syntax error!</font>"); } @OCIExecute($stmt); if($error = OCIError($stmt)) { die("<font color=red>ERROR!! Could not execute statement!</font>"); } return $stmt; }

« previous php.notes (#163727) next »