Random selections with PHP and MySQL

2

Is there any way to make random selects with php and mysql.

Example:

I have the table carreta_furacao:

id----nome
 1----Fofão
 2----Capitão América
 3----Popeye
 4----Mickey
 5----Palhaço 

2 - In PHP I make a random select *

3- Returns id 1 and 3

4- Click on the load button, and this activates another random select, this time will appear 2 other data except those with id 1 and 3 because these have already been.

5- The cycle repeats until all items are listed

* I found several ways to make random selections on the web, but I still do not know which one is best, if anyone can help thank you.

asked by anonymous 08.06.2016 / 20:17

1 answer

2

You can save all that go in an array by doing the query with ORDER BY RAND () and in the query do a SELECT WHERE id NOT IN ($ softkey)

    
08.06.2016 / 20:22