Jump to content

Recommended Posts

Posted

This code connects to a database and executes a command

$oracledb["host"] = "MYSERVICE"; # service name in the tnsnames.ora file
$oracledb["user"] = "myuser"; # username
$oracledb["pass"] = "mypass"; # password
$oracledb["library"] = "OCI";
$connect_id = ocilogon($oracledb["user"], $oracledb["pass"], $oracledb["host"]);
$query = "SELECT * FROM table";
$statement = ociparse($connect_id, $query);
ociexecute($statement);
$result = array();
while(ocifetchinto($statement, $tmp, OCI_ASSOC + OCI_RETURN_NULLS + OCI_RETURN_LOBS))
{
 array_push($result, $tmp);
}
ocifreestatement($statement);
var_dump($result); # result is here

From http://stackoverflow.com/questions/4583962/connect-to-an-oracle-database-using-php

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...