SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2001
    Location
    Helston, Cornwall, England
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Inserting random numbers into a field col

    Hi,

    I'm still having trouble with the same problem:

    http://www.sitepointforums.com/showt...search+results

    Is it possible to insert/update a field col with rand numbers automatically, lets say once a day?

    Then I guess I should be able to Order my results by this field and so have a result set that is different every 24 hours.

    I've tried to go down the RAND() route but with paging, the results are random on every loop, and if I seed the RAND, the results, though random, are always the same even when the same query is made.

    Help please!!

    Warren

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Order by rand(n), and set n = today's date?

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2001
    Location
    Helston, Cornwall, England
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, haven't tried it yet, but will that stop the results re-randomising on each re-iteration of the loop? The biggest problem I have found is just using Rand () the results are different when navigating forward and backward through them.

  4. #4
    SitePoint Enthusiast
    Join Date
    Oct 2001
    Location
    Helston, Cornwall, England
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    jofa,

    thanks, it works a treat and so simple to.

    Warren


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •