RE: [PHP-DB] Pulling random HTML code out of a table
| From: | Jon Haworth | Date: | Wed, 03 Jan 2001 17:45:44 +0000 |
| Subject: | RE: [PHP-DB] Pulling random HTML code out of a table | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-5571@lists.php.net to get a copy of this message | ||
...and in fact, reading the user comments on the RAND function, there is a
random number generator in SQL (surprise surprise). Play around with SELECT
... FROM ... WHERE ... ORDER BY RAND() LIMIT 1 and you may have some joy -
I've never used this myself so that's all the help I can give you about it!
Sorry for the multiple postings.
Cheers
Jon
-----Original Message-----
From: Mattias Johansson [mailto:smart@smartsmartsmart.com]
Sent: 03 January 2001 17:38
To: php-db@lists.php.net
Subject: [PHP-DB] Pulling random HTML code out of a table
Okay, this is the scenario:
I have a table with two columns. One called CodeID and one called code. In
the code column is HTML code. (duh)
Now, I want to create a query which chooses a random CodeID and pulls out
the code associated with it. I then simply echo the code unto the web page.
How do I make the query?
Really, really thankful for an answer!
/Mattias
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net