Call to a member function load() on a non-object
824946Dec 17 2010 — edited Dec 21 2010I am having problem in getting jpeg images from the Oracle database with php.
Below is segment of my code:
foreach ($result as $row)
{
echo "<input type='radio' name='imgNo' value='".$row["IMGID"]."'/>";
header("Content-type:".mime_type($row["IMGFILENAME"]));
header("Content-Disposition: filename=". $row["IMGFILENAME"]);
echo $row["IMGDATA"]->load();
echo $row["DESCRIPTION"]."<br>";
}
function displayImage($userName) {
$conn = connectDB();
$userId = getUserId($userName);
$query = "select IMGID,IMGDATA,DESCRIPTION,IMGFILENAME from IMAGES where USERID = :USRID";
$stid = oci_parse($conn, $query);
oci_bind_by_name($stid, ':USRID', $userId);
oci_execute($stid);
echo oci_fetch_all($stid,$arr, null, null, OCI_FETCHSTATEMENT_BY_ROW + OCI_ASSOC);
freeStmt($stid);
closeCon($conn);
return $arr;
}
The displayImage($userName) is in one php file while the foreach loop is in another file. I have added the php insert tag for the file to access the function. However, I am getting this error: Call to a member function load() on a non-object. It seems that php doesn't recongnise $row["IMGDATA"] as BLOB image. However, it is an BLOB image. I tried to echo $row["IMGDATA"] and it comes out one large chunk of data. Can anyone assist? thank you in advance.