I have a pretty straightforward application that accepts keywords from the user and uses them to build a query that is then submitted to Oracle. Here's a code snippet:
$stmt = OCIParse($conn,$query);
OCIDefineByName($stmt,"FIELD1",&$disp_field1);
OCIDefineByName($stmt,"FIELD2",&$disp_field2);
OCIDefineByName($stmt,"FIELD3",&$disp_field3);
OCIExecute($stmt);
if(!OCIFetch($stmt))
{
echo "Sorry! No matches found!";
}
while (OCIFetch($stmt))
{
echo $disp_field1. " " . $disp_field2 . " " . $disp_field3;
}
The OCIDefineByName seems to be where the problem is. If I echo $disp_field1 by itself, I get a blank reply, but there should be data there.
The query works, because I've echoed it out, then copied it into sqlplus. It returns 2 rows.
I've also tested for $stmt:
if(!$stmt){echo "no stmt!";} else {echo "stmt";}
and it's worked also.
Can anyone see what I'm doing wrong?
Thanks!