-
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:
-
what version of mysql are you using?
also remeber that RAND() is not meant to be a perfect random generator.
-
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
-
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?