Page 1 of 1

How To Open OLE on MS Access using PHP

Posted: Wed Nov 16, 2005 8:05 am
by jazzrhythm
I've created a database on MSAccess. Created a table and included a field for OLE and wanted to display it on the web. Assuming I only have one item on the table...

Code: Select all

<tr>
<td valign="top">
<?php
$conn=odbc_connect('perfume','','');
if (!$conn)
{exit("Connection Failed: " . $conn);}
$sql="SELECT * FROM Perfume WHERE Sex='M'";
$rs=odbc_exec($conn,$sql);
if (!$rs)
{exit("Error in SQL");}
while (odbc_fetch_row($rs))
{
$prodname=odbc_result($rs,"Product Name");
$brandname=odbc_result($rs,"Brand");
$price=odbc_result($rs,"Price");
$image=odbc_result($rs,"Image");

echo "<img src=$image>";
echo "<div>$prodname for Men by $brandname</div>";
}
odbc_close($conn);
?>
</td>
</tr>
I get the red X and lots of characters...
I believe there is something wrong with this line...

echo "<img src=$image>";

What do I need on there?

Thanks...
Burrito: Use php tags you should when Posting Code In The Forums you are

Posted: Wed Nov 16, 2005 8:38 am
by twigletmac
Is $image a path to an image or an actual image stored in the database?

Mac

Posted: Wed Nov 16, 2005 8:53 am
by jazzrhythm
Thanks for the response...

$Image is an image stored in a database...

Give you more details on the database, maybe, it's where I did something wrong...

Used MS Access, created a Table then I have a Field named "Image" aside from the other Fields I created. And the Data Type is OLE Object. Saved Table, afterwards, opened Table. Right-Click on the cell under Image and selected Insert Object. Next, selected Create From File and then browsed to the image, it's *.bmp, Finally, clicked Ok.

What I have on the cell says, "Bitmap Image". When I double-clicked on it, Paint comes up and shows the image.
So, I believe I have an image there even if I don't see it on the cell.

Any ideas on how I can display that image on the browser?