O
Oli Waters
Hi everyone
I have set up a simple online shopping webpage in which a user selects
a product type and then clicks 'view products'. The data is then
retrieved from a mysql database and displayed on the page. All this
works fine apart from one part. I want to display a picture of the
product. In my database the column PRODDESC contains a link to a
picture on my hard disk. How do i code it so that it actually displays
the picture rather than displaying the link itself. 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>"; <--- IM SURE ITS THIS BIT!!
print "<td><p>@$_[2]</p></td>";
# Round price to 2 decimal places
print "<td><p>£" . sprintf("%.2f", @$_[3]) . "</p></td>";
I've labelled the thing i think is wrong...do i need an src= or
something??
Thanks in advance
Oli
I have set up a simple online shopping webpage in which a user selects
a product type and then clicks 'view products'. The data is then
retrieved from a mysql database and displayed on the page. All this
works fine apart from one part. I want to display a picture of the
product. In my database the column PRODDESC contains a link to a
picture on my hard disk. How do i code it so that it actually displays
the picture rather than displaying the link itself. 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>"; <--- IM SURE ITS THIS BIT!!
print "<td><p>@$_[2]</p></td>";
# Round price to 2 decimal places
print "<td><p>£" . sprintf("%.2f", @$_[3]) . "</p></td>";
I've labelled the thing i think is wrong...do i need an src= or
something??
Thanks in advance
Oli