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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...