SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    May 2003
    Location
    virginia
    Posts
    988
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Random set by key?

    Hi,

    What I have is a basic product navigator. The page is here:
    http://frecklewonder.com/clothing/

    I want the set of products to be random, per session. I can figure out how to do the session part (php), but how can I generate a random set, and then continue on with that random set per session? Rand() gets a completely new random set each time, I need to select by random, and then continue to get the same set for each page (page 1, page 2, next/prev etc...), but moving through the set.

    Anyone know how I can do this?

    Matt

  2. #2
    SitePoint Addict
    Join Date
    May 2004
    Location
    .
    Posts
    227
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Matt,

    You need to store the random generated data somewhere (in a mysql table, using session_register(), etc).
    Ilya Devyatovsky
    ThinkHost, Inc.
    Wind/solar powered web hosting - 6 months free!

  3. #3
    SitePoint Guru
    Join Date
    May 2003
    Location
    virginia
    Posts
    988
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ahh, right. So just store the whole result set?

    Matt

  4. #4
    SitePoint Addict
    Join Date
    May 2004
    Location
    .
    Posts
    227
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yep. Otherwise you'll need a non-random method of generating of resulset.
    Ilya Devyatovsky
    ThinkHost, Inc.
    Wind/solar powered web hosting - 6 months free!


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
  •