Random Record Retrieval
| From: | Robb Kerr | Date: | Sat, 22 May 2004 21:59:08 +0000 |
| Subject: | Random Record Retrieval | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-186771@lists.php.net to get a copy of this message | ||
How's that for alliteration in a subject line?
Got a simple MySQL table that contains records which are made up of only
three fields - ID, quote and author. These are "inspirational" quotes that
I want to appear at the bottom of the pages of my website. I want them to
come up randomly with every page load. I've posted this on a MySQL board to
see if there's a MySQL command to make things simple. But, I thought about
building a random number generator in PHP that selects a random number out
of the total number of records in the table, saves it into a variable and
then have MySQL retrieve that ID. Is this the way to go or is there
something simpler. And, if this is the best way to go, unfortunately I
don't know how to write a random number generator in PHP so would
appreciate any help.
Thanx in advance,
Robb
--
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams
http://www.digitaliguana.com
http://www.cancerreallysucks.org