Last edited by Droppy; 26-09-15 at 08:47 PM. Reason: Fixed to make comment more constructive.
May i suggest using mt_rand() function instead of rand()? mt_rand is expected to be 4x faster than the rand function, as it uses the Mersene Twister algorithm.
Just a heads up, when everybody else is bitching about the use of mysql_query function >_>