displaying pictures from a link in a mysql database

O

Oli Waters

Hi everyone,

I have made a simple online shopping website in which a user selects a
type of product they require and then clicks 'view products'. The
product data is retrieved from the mysql database and is displayed on
the page. All this works fine apart from one part. The column PRODDESC
is a link to a picture on my hard drive. How do i code it so that it
displays this link as a picture and not just printing the link on the
page. Here is the offending code...

## Execute query
my @rs = DBQuery($dbh, "SELECT PRODUCTID, PRODDESC, DATEADDED, PRICE
FROM PRODUCTS WHERE ORDERNO IS NULL AND PRODTYPE=\"$_[0]\"")
or die("DBQuery: $DBI::errstr");

## For each dataset row print in table row
foreach (@rs) {

## Set table row's background colour
$trbgcolor=($yellow)?"#F7F7DE":"white";
print "<tr height=40 style='background-color:$trbgcolor;'>";
$i=0;

## Print add to cart button and product details
print "<td align=left><input class=bluebutton
onclick='AddToCart(this);' type=button value='Add to Cart'
name='@$_[0]'></td>";
print "<td><p>@$_[1]</p></td>"; <--- I THINK THIS IS WRONG!
print "<td><p>@$_[2]</p></td>";

# Round price to 2 decimal places
print "<td><p>£" . sprintf("%.2f", @$_[3]) . "</p></td>";

Do i need an src= or something before it??

Thanks in advance

Oli
 
M

Matt Garrish

<snip slightly reworded, but otherwise identical question>

Please don't repost the same question. If there are any major errors in your
first attempt, you can always post a follow-up and explain what you really
meant. If you repost the entire question because you didn't like the way it
read the first time, you either need to slow down and proof your posts
before submitting them or you're itching to get into people's kill files.

Matt
 
A

Andy Baxter

At earth time Sun, 11 Jan 2004 10:07:50 -0500, the following transmission
was received from the entity known as Matt Garrish:
<snip slightly reworded, but otherwise identical question>

Please don't repost the same question. If there are any major errors in your
first attempt, you can always post a follow-up and explain what you really
meant. If you repost the entire question because you didn't like the way it
read the first time, you either need to slow down and proof your posts
before submitting them or you're itching to get into people's kill files.

Matt

Or if you catch it quickly (less than half an hour or so), you can use the
cancel or (better) supersede function in your newsreader to remove the
previous version and post another. Not all newsservers respect this
though, so use with caution.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top