displaying pictures from a link in a mysql database

Discussion in 'Perl Misc' started by Oli Waters, Jan 11, 2004.

  1. Oli Waters

    Oli Waters Guest

    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
    Oli Waters, Jan 11, 2004
    #1
    1. Advertising

  2. Oli Waters

    Matt Garrish Guest

    "Oli Waters" <> wrote in message
    news:...

    <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
    Matt Garrish, Jan 11, 2004
    #2
    1. Advertising

  3. Oli Waters

    Andy Baxter Guest

    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" <> wrote in message
    > news:...
    >
    > <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.
    Andy Baxter, Jan 12, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. news.onet.pl
    Replies:
    1
    Views:
    295
  2. Martin Raychev
    Replies:
    1
    Views:
    273
    Alvin Bruney [MVP]
    Mar 2, 2004
  3. qqqq

    Pictures not displaying

    qqqq, Jan 19, 2005, in forum: ASP General
    Replies:
    4
    Views:
    114
  4. Oli Waters
    Replies:
    3
    Views:
    91
    Andy Baxter
    Jan 12, 2004
  5. David. E. Goble

    displaying a list of pictures?

    David. E. Goble, May 21, 2005, in forum: Javascript
    Replies:
    3
    Views:
    77
    Random
    May 23, 2005
Loading...

Share This Page