Sharing things out equally

Discussion in 'PHP' started by crazyryan, Mar 8, 2007.

  1. #1
    Basically I need to know, if I had 5 records in a database and 10 people visited my site. How could I show the 5 records equally, so in this case, each record would be shown twice.

    Anyone know
     
    crazyryan, Mar 8, 2007 IP
  2. php_daemon

    php_daemon Active Member

    Messages:
    34
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    95
    #2
    You wanna show a record per person, and then repeat all over again if there are more people than records?

    I think you can have a counter for each record, that you'd increase every time you show the record. Then use a query something like:
    
    select * from t1 order by counter asc limit 1
    
    Code (markup):
    to select a record. Then increase the counter for that record as soon as you select it.

    Hope it helps.
     
    php_daemon, Mar 8, 2007 IP