How to echo random number numbers from mysql database without repeating numbers?
this is my sample code:
$query = mysql_query("SELECT * FROM store"); $number=mysql_num_rows($query); for ($count=1; $count<= $number ; $count++) { $id = mysql_query ("SELECT id FROM store ORDER BY RAND() LIMIT $number"); $id = mysql_fetch_assoc($id); $id = $id['id']; echo $id; }
It will echo six random numbers, but it has instances such as "1 1 3 2 4 5", where 1 is repeated twice, not once. thank you in advance
source share