I've currently entered 10 links into a csv file and uploaded. the column is called links and the table is called landmarks. I've only ever selected things from the database rather than randomly generating a link. I want to have a button on my page that you click and it can randomly select a link from the database. How do I do that, and then how do I make it so that when it is randomly generated that page will then open?
Asked
Active
Viewed 70 times
-4
-
A CSV file is not a mysql database... – qwertynl Jan 13 '14 at 17:02
-
that's just the file I used to upload my links into the database – 5dollar Jan 13 '14 at 17:03
-
possible duplicate of [Selecting Random Rows in MySQL](http://stackoverflow.com/questions/1283640/selecting-random-rows-in-mysql) – Markus Malkusch Jan 13 '14 at 17:05
1 Answers
0
You can add: order by rand()
to your query or you can use a PHP loop to take the 10 data points from your db into an array then use rand(0,9)
to get a random ID from your array to output.

the_pete
- 822
- 7
- 19