manalnor Posted August 13, 2011 Share Posted August 13, 2011 Hello dear friends, I know that i can write it for MYSQL database as $qry="select names from tools order by RAND()"; $result=mysql_query($qry) or die($qry); My question how can i may it random in certain range for example show 4 " names" in random way in range of "1" to "10" order by id ? to to write it in another way i ask about random "RAND()" in certain range How ! Thanks Quote Link to comment https://forums.phpfreaks.com/topic/244695-how-to-use-rand/ Share on other sites More sharing options...
jcbones Posted August 13, 2011 Share Posted August 13, 2011 All about RAND() Quote Link to comment https://forums.phpfreaks.com/topic/244695-how-to-use-rand/#findComment-1256829 Share on other sites More sharing options...
voip03 Posted August 13, 2011 Share Posted August 13, 2011 $qry="select names from tools where id='". rand(1, 10)."';"; Quote Link to comment https://forums.phpfreaks.com/topic/244695-how-to-use-rand/#findComment-1256835 Share on other sites More sharing options...
manalnor Posted August 13, 2011 Author Share Posted August 13, 2011 @jcbones thank you for this reference very helful @voip03 very nice idea Quote Link to comment https://forums.phpfreaks.com/topic/244695-how-to-use-rand/#findComment-1256841 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.