Random selection

Discussion in 'PHP' started by Jim bob 9 pants, Mar 11, 2005.

  1. #1
    Hello,

    Please can you assist,

    I am trying, in essence to creat a rotating banner ad within my site, similar to the DP co-op, showing different ads on a refresh or a new page

    I have 5 images with corrosponding urls that I want to display, in my data base, but I do not want the same data set to show twice.

    So i think I want a 1 out of 5 on the first page load then a 1 out of 4 on all the next............ Cany you help? :(
     
    Jim bob 9 pants, Mar 11, 2005 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,818
    Likes Received:
    4,536
    Best Answers:
    123
    Trophy Points:
    665
    #2
    sarahk, Mar 11, 2005 IP
  3. dtan

    dtan Peon

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    you could possibly store the ads shown in the session. When an ad is shown, stick it in an array in the session. Then take the array difference between the ads and the ads shown and get the next add from that. Then once all the ads are shown, reset the the session array and start over.
     
    dtan, Mar 11, 2005 IP