Oracle and PHP
Posted: Fri Jan 09, 2004 1:02 pm
I am trying to connect to Oracle 9i db. I am trying to query for a jpeg. I keep on recieving a windows download popup after executing the webpage. I have enclosed the code. The sql is correct. Dont know what else is wrong. PHP and GD is setup correctly. I can view jpegs through php. Thanks.
Code: Select all
<?php
$username = "xxxxxxxx";
$passwd = "xxxxxxxxx";
$db="xxxxxxxxxx";
$conn = OCILogon($username,$passwd,$db);
if (!$conn) {
echo "Connection failed";
echo "Error Message: ї" . OCIError($conn) . "]";
exit;
}
else
{
echo "Successfully Connected to Database!\n\n";
}
;
$conn = OCILogon($user, $password,$db );
$query = "select dbd_image from database where patronid ='11111111'";
$stmt = OCIParse($conn, $query);
$err = OCIExecute($stmt);
OCIFetchInto($stmt);
header('Content-Type: image/jpg');
print $stmt;
ocilogoff($conn);
?>