Forum Moderators: coopster

Message Too Old, No Replies

Displaying pictures in HTML from a database

PHP Picture retriveval

         

TristanB

3:16 pm on Mar 18, 2010 (gmt 0)

10+ Year Member



Hi,

I've been trying to display results from my database, one column of which is a picture (Long BLOB type). I tried to simply return the contents of the cell, which unsurprisingly didn't work. This is my code:

//Connection to database
$query = "SELECT * FROM Product WHERE Product_Name LIKE '%$search%'";
$result = mysql_query($query);

echo "<table cellpadding =10 border=1>";
while ($row = mysql_fetch_row($result)) {
echo "<td>".$row[ 0 ]."</td>";
echo "<td>".$row[ 1 ]."</td>";
echo "<td>".$row[ 2 ]."</td>";
echo "<td>".$row[ 3 ]."</td>";
echo "<tr>";

The row containing the pictures is the fourth (row3), being put dynamically into a table regardless of how many entries there are in the database. Everything works, just the picture doesn't parse properly.

Can anyone give me any pointers?

[edited by: jatar_k at 3:51 pm (utc) on Mar 18, 2010]
[edit reason] made it more readable [/edit]

Anyango

4:34 pm on Mar 18, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld TristanB

Take a look at

[webmasterworld.com...]