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
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