Re: random select
| From: | Jason Wong | Date: | Tue, 17 Dec 2002 11:32:45 +0000 |
| Subject: | Re: random select | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-24220@lists.php.net to get a copy of this message | ||
On Tuesday 17 December 2002 18:46, Bruce Levick wrote:
> Bruce Levick - VivamotionI was curious as to what is the best way to select
> a random row from a table in my database.
>
> I have currently five rows and will be expanding on that as well. I have
> tried this code.
>
> ########################################################################
> //retrieve random row
> <?php
> $rndm = mysql_query("SELECT * FROM Illustrations ORDER BY RAND() LIMIT
You need to use one of the mysql_fetch_*() functions. Details and examples in
manual.
> but am not getting anything when output with PHP in a browser. I am
> working off localhost on a WINXP machine. PHP 4.2.2.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
"Ain't that something what happened today. One of us got traded to
Kansas City."
-- Casey Stengel, informing outfielder Bob Cerv he'd
been traded.
*/