[SOLVED] Oracle query HELP!

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
jamesloi
Forum Newbie
Posts: 15
Joined: Thu Jul 15, 2004 5:11 am
Location: London

[SOLVED] Oracle query HELP!

Post by jamesloi »

Hi,

Does anyone know how to chnage this code so that it uses the ORA functions instead of the OCI...

Code: Select all

<?php
$s = OCIParse($c, "SELECT * FROM ML_Account WHERE ACCOUNTNUM ='$account'"); 

OCIExecute($s, OCI_DEFAULT); 

while (OCIFetch($s)) { 

//Agent Name 
echo ". ociresult($s, "NAME") . "; 

}
?>
Thanks :D
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

Code: Select all

$query = "SELECT * FROM ML_Account WHERE ACCOUNTNUM ='$account'";
$conn = ora_logon('user', 'password');
$curs = ora_open($conn);
ora_parse($curs, $query);
ora_exec($curs);
while(ora_fetch_into($curs, $row, ORA_FETCHINTO_ASSOC)) {
    echo $row["NAME"];
}
jamesloi
Forum Newbie
Posts: 15
Joined: Thu Jul 15, 2004 5:11 am
Location: London

Post by jamesloi »

Thanks dude i tried your code but i am getting these errors..

Code: Select all

Warning: ora_open(): supplied argument is not a valid Oracle-Connection resource in c:\inetpub\wwwroot\GLOBALCOM_FINAL\transactions.php on line 98

Warning: ora_parse(): supplied argument is not a valid Oracle-Cursor resource in c:\inetpub\wwwroot\GLOBALCOM_FINAL\transactions.php on line 99

Warning: ora_exec(): supplied argument is not a valid Oracle-Cursor resource in c:\inetpub\wwwroot\GLOBALCOM_FINAL\transactions.php on line 100

Warning: ora_fetch_into(): supplied argument is not a valid Oracle-Cursor resource in c:\inetpub\wwwroot\GLOBALCOM_FINAL\transactions.php on line 102
I have checked that my php can connect with oracle using a test script...help!
jamesloi
Forum Newbie
Posts: 15
Joined: Thu Jul 15, 2004 5:11 am
Location: London

Post by jamesloi »

OK thanks dude i sorted it now...it was my fault.. i typed out the code incorrectly :D
Post Reply