Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Call to a member function load() on a non-object

824946Dec 17 2010 — edited Dec 21 2010
I 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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 18 2011
Added on Dec 17 2010
3 comments
1,014 views