/    Sign up×
Community /Pin to ProfileBookmark

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 ?

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@Mohammed_ZayanNov 07.2012 — 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
Copy linkTweet thisAlerts:
@NogDogNov 07.2012 — 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.
Copy linkTweet thisAlerts:
@manjuhugar24authorNov 07.2012 — 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 ?
×

Success!

Help @manjuhugar24 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...