Forums
(@hamletdrc)
13 years, 5 months ago
The previous answers are all subtly wrong.
This code: mt_rand(1,sizeof($comments)) - 1;
mt_rand(1,sizeof($comments)) - 1;
Will never return the number zero, and never return the first record in your database. The code should be: mt_rand(0,sizeof($comments)) - 1;
mt_rand(0,sizeof($comments)) - 1;