Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

oracle connectivity with PHP

Status
Not open for further replies.

khalique

Programmer
Aug 25, 2001
3
GB
i want to know how the oracle connect with the database of Oracle 8i
 
First, you need to make sure that you have ORACLE_HOME and ORACLE_SID set. If they arent' you can set them manually in your script by using the putenv() function. Next, to connect:

if(!$c = ora_logon("username","password")) {
die("Could not logon");
}

if(!$curs = ora_open($c)) {
die("Could not open Cursor");
}

$q = "SELECT * FROM my_table";

if(!ora_parse($curs,$q)) {
die("could not parse query");
}

if(!ora_exec($curs)) {
die("Could not execute query");
}

and so on!

Hope this helps.

Chad. ICQ: 54380631
 
I am sorry, I missed the 8i part of your question.

Here you go:

//Oracle 8 logon
$c = ocilogon("username","password");

$q = "SELECT my_name FROM my_table";

//Oracle 8 query parse
$p = ociparse($c,$q);

//associate column with variable $name
ocidefinebyname($p,"my_col", &$name);

//execute query
ociexecute($p);

//fetch data
ocifetch($p);

//free query
ocifreestatement($p);

//close connection
ocilogof($c);

and so on...

Chad. ICQ: 54380631
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top