Re: php, oracle, OCIExecute()
From: Mike Blake <michael.blake_at_ot-t.com>
Date: 21 Mar 2003 06:45:19 -0800
Message-ID: <341edc35.0303210645.30c59a65_at_posting.google.com>
}
Date: 21 Mar 2003 06:45:19 -0800
Message-ID: <341edc35.0303210645.30c59a65_at_posting.google.com>
Right, here's how I did it:
//Connect:
$db="(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =
$oracle_host)(PORT = $oracle_port))(CONNECT_DATA = (SID =
$oracle_sid)(SERVICE_NAME = $oracle_service)))";
$conn=ocilogon($db_oracle_username,$db_oracle_password,$db);
//Do a query:
$query="select id, forename, surname from USERS where id='1' ";
$stmt = ociparse($conn, $query);
if(!$stmt) {
if($DEBUG=="1") {
user_error("<b><font color=red>Database connection
problem!</font></b>");
var_dump(ocierror($conn));
}
} else {
$err=ociexecute($stmt,OCI_DEFAULT);
if(!$err) {
if($DEBUG=="1") {
user_error("<b><font color=red>Database connection
problem!</font></b>");
var_dump(ocierror($stmt));
}
} else {
while (ocifetch($stmt)) {
//NOTE THAT FIELD NAMES HAVE TO BE IN UPPER CASE FOR THIS TO WORK
$id=ociresult($stmt, "ID");
$id=ociresult($stmt, "FORENAME");
$id=ociresult($stmt, "SURNAME");
}
}
}
I don't really understand what your problem is but the above worked fine for me on a similar configuration to yours. Enjoy (hopefully!) Received on Fri Mar 21 2003 - 15:45:19 CET
