1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How do I pull an image from a database number result ?

Discussion in 'Databases' started by Amilo, Jan 17, 2007.

  1. #1
    I have a database set up that displays a random set of 4 numbers from one to fifty.

    I have an image folder on the site with 50 images numbered one to fifty.

    What I want to be able to do is when the 4 numbers are called I want to be able to display the images that corispond to those 4 numbers.
     
    Amilo, Jan 17, 2007 IP
  2. maiahost

    maiahost Guest

    Messages:
    664
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you post how that works I will give you the code, even though I expect it to be
    php rand(0, 50);
     
    maiahost, Jan 17, 2007 IP
  3. Amilo

    Amilo Peon

    Messages:
    624
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It Is a sports results database.

    4 numbers are pulled out as results depending on the date that is entered,so results are not random but already entered in number form.

    Sorry I should not of used the word RANDOM in my post.
     
    Amilo, Jan 17, 2007 IP
  4. maiahost

    maiahost Guest

    Messages:
    664
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #4
    well something like this :
    
    <?php
    echo '<img src="http://www.site.com/images/'.$row["number"].'.jpg">';
    ?>
    
    PHP:
    Should do the trick with a bit of modification.
     
    maiahost, Jan 17, 2007 IP
  5. Amilo

    Amilo Peon

    Messages:
    624
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thank you.

    With a bit of playing around it worked great...
     
    Amilo, Jan 18, 2007 IP