Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 2nd, 2004, 06:33 AM
decyco decyco is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Location: Belgium
Posts: 1 decyco User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Oracle queries using PHP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT