|
-
Jan 26th, 2003, 12:21 AM
#1
Thread Starter
Fanatic Member
RAND() error
What's wrong with this statement?
PHP Code:
$query = mysql_query("SELECT link FROM downloads WHERE version='".$version."' ORDER BY RAND() LIMIT 1");
I run this and always get the same entry for a link. There are 3 different rows which match the criteria, but I always get the same row everytime i run the script.....:Bang:
-
Jan 26th, 2003, 11:34 AM
#2
Frenzied Member
what version of mysql are you using?
also remeber that RAND() is not meant to be a perfect random generator.
-
Jan 26th, 2003, 11:56 AM
#3
Thread Starter
Fanatic Member
3.23.54-nt is my mysql version
and i know it isnt perfect, but i ran it over 200 times and it is always the same output. thats not right
-
Jan 26th, 2003, 12:10 PM
#4
Frenzied Member
well I can see version='$version' it will always be what the $version is, it can't be random. try it like this
PHP Code:
$query = mysql_query("SELECT link FROM downloads ORDER BY RAND() LIMIT 1");
what is $version and where is it coming from?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|