note 32304 deleted from function.ora-parse by didou

From: Date: Fri, 23 May 2003 09:28:10 +0000
Subject: note 32304 deleted from function.ora-parse by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-48866@lists.php.net to get a copy of this message
Note Submitter: kerxen@caramail.com ---- Maybe newbies don't know in which order to use all the ORA_FUNCTIONS. Where do I use the ora_parse function?!!! Here is a function to execute queries. But it is not made for SELECT queries, because the cursor is closed at the end but you can adapt it. Moreover, you need to logon and logoff (obviously)... SYNOPTIC : $conn = ora_logon ("user@TNSNAME", "pass"); $query=""; execute_query ($query,$conn); ora_logoff ( $conn) ; /*------------------- Here is the execute_query function -------------------*/ function execute_query ($query,$conn){ // ouveture du curseur , create a cursor if (!($cursor= ora_open($conn))) { reportError ($conn, " Cursor could not be opened! "); exit; // Termine le script courant , end the script } // parse query // analyse la requete et l'associe au curseur, analyse the query and use the cursor for it if (!ora_parse ($cursor, $query)) { reportError ($cursor, " Statement could not be parsed! "); exit; } // execution de la query, execution of the query if (!ora_exec($cursor)) { reportError ($cursor, " Statement could not be executed! "); exit; } // ferme le curseur oracle, close the cursor ora_close($cursor); // valide la transaction, validation of the transaction (if any) ora_commit($conn); } /*------------------- Here is the reportError function. -------------------*/ function reportError($code,$message ="") { print ("$message\n"); print ("Code Erreur: " . ora_errorcode($code) . "\n"); print ("Message d'Erreur: " . ora_error($code) . "\n"); } Use it hard! Eddy Cingala

« previous php.notes (#48866) next »