|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Oracle queries using PHP
I've got some troubles running combined queries using PHP:
I have two tables, "patients" and "appointments". In the appointments-table there is a key AP_PATKEY which is the link to the key P_KEY in the table patients. Purpose is to look which appointment has been changed (AP_DATECHANGED in appointments) and to return the name of the patient (P_NAME in patients). However, when I combine the query in PHP, I'v got the following errors: Warning: ociexecute(): OCIStmtExecute: ORA-03106: fatal two-task communication protocol error in test2.php on line 20 Warning: ocifetch(): OCIFetch: ORA-24374: define not done before fetch or execute and fetch in test2.php on line 38 Source code is below: <html> <head> <meta http-equiv="Content-Language" content="nl-be"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Overview today changed appointments</title> </head> <body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0"> <?php $thisday = date("d-M-y"); $database = $dbase; $userid = "xxx"; $paswd = "xxx"; putenv('ORACLE_HOME=/home/oracle/Ora9204'); $mycon = OCILogon($userid, $paswd, $database); $cursor = OCIParse($mycon, "SELECT a.AP_KEY, a.AP_DATE, a.AP_PATKEY, a.AP_DATEMADE, a.AP_DATECHANGED, a.AP_REQUESTEDBY_COM, p.P_KEY, p.P_NAME FROM appointments a, patients p WHERE a.AP_DATECHANGED >= '$thisday' AND a.AP_DATE = '$thisday' AND a.AP_PATKEY = p.P_KEY"); OCIExecute ($cursor, OCI_DEFAULT); ?> <p align="center"><u><b><font face="Verdana" size="2">Overview (changed) appointments today (on <? echo $database ?>):</font></b></u></p> <p><font face="Verdana" size="2">Current date is: <? echo $thisday ?></font></p> <p><font face="Verdana" size="2">List of changed appointments for today:</font></p> <table border="1" width="100%" style="font-family: Verdana; font-size: 10pt; color: #0000FF" bgcolor="#C0C0C0"> <tr> <td align="center"><u><b>AP_KEY</b></u></td> <td align="center"><u><b>AP_DATE</b></u></td> <td align="center"><u><b>AP_PATKEY</b></u></td> <td align="center"><u><b>P_NAME</b></u></td> <td align="center"><u><b>AP_DATEMADE</b></u></td> <td align="center"><u><b>AP_DATECHANGED</b></u></td> <td align="center"><u><b>AP_REQUESTEDBY_COM</b></u></td> </tr> <?php $teller = 1; while (OCIFetch($cursor)) { $apdat[$teller] = ociresult($cursor, "AP_DATE"); $key[$teller] = ociresult($cursor, "AP_KEY"); $identification[$teller] = ociresult($cursor, "AP_PATKEY"); $creadat[$teller] = ociresult($cursor, "AP_DATEMADE"); $datchanged[$teller] = ociresult($cursor, "AP_DATECHANGED"); $requestor[$teller] = ociresult($cursor, "AP_REQUESTEDBY_COM"); $patname[$teller] = ociresult($cursor, "P_NAME"); ?> <tr> <td><? echo $key[$teller]; ?></td> <td><? echo $apdat[$teller]; ?></td> <td><? echo $identification[$teller]; ?></td> <td><? echo $patname[$teller]; ?></td> <td><? echo $creadat[$teller]; ?></td> <td><? echo $datchanged[$teller]; ?></td> <td><? echo $requestor[$teller]; ?></td> </tr> <?php $teller = $teller + 1; } OCILogoff($mycon); ?> </table> <?php ?> </body> </html> What do I do wrong? Thanks in advance for any help. Eric |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Oracle queries using PHP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|