Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > displaying pictures from a link in a mysql database

Reply
Thread Tools

displaying pictures from a link in a mysql database

 
 
Oli Waters
Guest
Posts: n/a
 
      01-11-2004
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
 
Reply With Quote
 
 
 
 
Matt Garrish
Guest
Posts: n/a
 
      01-11-2004

"Oli Waters" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...

<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


 
Reply With Quote
 
 
 
 
Andy Baxter
Guest
Posts: n/a
 
      01-12-2004
At earth time Sun, 11 Jan 2004 10:07:50 -0500, the following transmission
was received from the entity known as Matt Garrish:

>
> "Oli Waters" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) om...
>
> <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.

--
http://www.niftybits.ukfsn.org/

remove 'n-u-l-l' to email me. html mail or attachments will go in the spam
bin unless notified with [html] or [attachment] in the subject line.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
using mysql client to read a file to create a table in a database in a mysql server julian Ruby 8 04-06-2006 10:29 AM
displaying pictures in perl from mysql database Oli Waters Perl Misc 3 01-12-2004 08:56 AM
Displaying images from a MySQL Database Matt ASP .Net 0 08-01-2003 10:25 AM



Advertisments