DB-stored images
| From: | Ohlson Stefan | Date: | Tue, 26 Nov 2002 09:31:58 +0000 |
| Subject: | DB-stored images | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-23663@lists.php.net to get a copy of this message | ||
Hi!
I have a db where we stores images in the database but I haven't figured out how I display
that image after I've selected it from the table.
I've tried with <IMG SRC='$data'> and <IMG SRC=$data> but $data just
return the Select-query:
<html><head><title></title></head>
<body bgcolor=cccccc text=000000 link=0000ff vlink=0000ff>
<B>Picture</B><BR><UL>
<IMG SRC='SELECT PICTURE FROM KATALOGUE WHERE ISBN = '91-29-65480-7''>
</UL></body></html>
Anyone have an idea what I can do?
Thanks!
Here is the script:
=====================================================
<?
$handle = ORA_LOGON("something/something","") OR DIE("Unable to connect to
database");
print "<html><head><title></title></head>\n";
print "<body bgcolor=cccccc text=000000 link=0000ff vlink=0000ff>\n";
if ($type == Author){
$SqlStatement = "SELECT ...";
} else if ($type == Titel){
$SqlStatement = "SELECT ...";
} else if ($type == Picture) {
$SqlStatement = "SELECT PICTURE FROM KATALOGUE WHERE ISBN = '$isbn'";
}
$csr = ORA_OPEN($handle) OR DIE("Unable to open data database cursor");
ORA_PARSE($csr, $SqlStatement)OR DIE("Unable to parse query");
ORA_EXEC($csr) OR DIE("Unable to run query");
print "<B>$type</B><BR><UL>\n";
while(ORA_FETCH($csr)){
$data = ORA_GETCOLUMN($csr,0);
if ($type == Picture){
print "<IMG SRC='$data'>\n";
} else {
print "<LI>$data</LI>\n";
}
}
print "</UL></body></html>\n";
ORA_CLOSE($csr);
ORA_LOGOFF($handle);
?>
//Stefan