It's actually very simple : Just use
SELECT * FROM tbl_name ORDER BY RAND() LIMIT 1
Cheers - Neil
At 17:35 04/09/2004 +0000, you wrote:
Message-ID: <001b01c492a9$275ab1c0$95703ad8@ron> From: "Ron Piggott" <ron.php@xxxxxxxxxxxxxxxxxx> To: "PHP DB" <php-db@xxxxxxxxxxxxx> Date: Sat, 4 Sep 2004 14:00:56 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Subject: Displaying Text From A Data File
I am still new to PHP and I wanted to ask a question.
I am wanting to create a PHP script to randomly display one of many greeting messages on my web site. I was going to store them in a text based file. I wanted PHP to randomly select one of them and display it each time the script was loaded.
I am still new at PHP and I am not sure where to get started. But I was thinking about this and I am sure this has already been done many times ... I am not sure where to look on the web.
Can any of you help me get started?
Ron
======================================================== CaptionKit http://www.captionkit.com : Production tools for accessible subtitled internet media, transcripts and searchable video. Supports Real Player, Quicktime and Windows Media Player.
VideoChat with friends online, get Freshly Toasted every day at http://www.fresh-toast.net : NetMeeting solutions for a connected world.
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php