www.webdeveloper.com
Results 1 to 4 of 4

Thread: Random data from mysql

  1. #1
    Join Date
    Mar 2012
    Location
    bangalore,india
    Posts
    27

    Red face Random data from mysql

    HI everyone,
    I want to fetch random questions from mysql in to my web page for this i have used RAND() function but the poblem is everytime i refresh my webpage data is randomizing but i want random data only once and it should not randomize again on page refresh.Can anyone help me please ?

  2. #2
    Join Date
    Apr 2012
    Location
    Egypt
    Posts
    21
    the total rows should be big than your limit
    if you view 10 rows in the page you must have more than 10 in your database

  3. #3
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,392
    Store the results of the query in session data, and then only actually run the query (and populate that session data) if the session data is empty.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  4. #4
    Join Date
    Mar 2012
    Location
    bangalore,india
    Posts
    27
    Thank you so much NogDog it really worked for me as you said i stored my query in session variable and it executes only if that session is not set.
    Thanks once again

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles