Displaying image from database


Posted on 16th Feb 2014 07:03 pm by admin

Hi,

I've got a site where that's got a database behind it. Currently it has loads of items in rows that all have different pictures. There is a field called "Image" that has the name of the image ie. example.jpg.

Then I have a folder on my webserver called image where the pictures are stored with the same file names and extensions.

Now, I want to display the correct image for the item that the page is showing. I have this code but it's just showing the usual box with a red X in the top left.

I should also point out that the 'Item' line is working correctly and displaying the name of the item.

Quote<table border='1' align="left" width="100%">
<?php
while($row = mysql_fetch_array( $result )) {
$dir = '/image';
$image = $row['Image'];
echo('<b><h1>'.$row['Item'].'</h1></b><br />');

echo "<tr>";
echo "<td width=15%>"."<img width=100% src='$dir/$image /'></td>";
echo "<td width=85% align=center>Description</td>";
echo "</tr>";
}
?>
</table>
Any ideas why this isn't working?

No comments posted yet

Your Answer:

Login to answer
104 Like 35 Dislike
Previous forums Next forums
Other forums

I am stumped
OK. Here is what I am trying to do. I have the conditions set, and if the conditions are met, I want

How to give the privillege for triggers?
Hi,

How to give the privillage for triggers to particular user?

Please let me

Why will this program not run if the variables are not global?
Hey guys I have a kind of perplexing situation that is probably simple, but I can't seem to understa

Help: problem with Headers to download PDF file
Hi,

I'm trying to implement a script where when a user clicks a link he gets a PDF file to op

quick question about System Change Number(SCN) in FlashBack Query topic
i know tht we can get the SCN of the database using flashback concept as follows

SQL>

Navigation include for all site directories
Hi,

I need a navigation include that can deal with directories at different levels on a site.

background color imagefill
Hello

I would like to ask you why I see this square in red color just in my local xampp insta

Problem with coding MySQL query
I'm having heaps of trouble getting one of my PHP/MySQL queries to work for some reason (and the fun

Inserting multiple records from single form
I've found a number of threads that deal with this issue, but I'm new to php and coding language so

Help with email validation please...
Hi,
Please could you help.
I have a register.php login page where users register, the detail

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash