3raser Posted March 10, 2011 Share Posted March 10, 2011 How do you generate a random number like say, 0 through 10? I want to select random sites from my database that have IDs 0 through 10. Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted March 10, 2011 Share Posted March 10, 2011 rand() should work: http://php.net/manual/en/function.rand.php Quote Link to comment Share on other sites More sharing options...
devWhiz Posted March 10, 2011 Share Posted March 10, 2011 ".rand(1,10)." Quote Link to comment Share on other sites More sharing options...
3raser Posted March 10, 2011 Author Share Posted March 10, 2011 Thanks guys, much appreciated for the quick replies. Quote Link to comment Share on other sites More sharing options...
oldmatt Posted March 10, 2011 Share Posted March 10, 2011 Or you could use mt_rand(). http://www.php.net/manual/en/function.mt-rand.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.