Re: Banner rotation with links

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Feb 15, 2007, at 10:57 AM, Jochem Maas wrote:

Kevin Murphy wrote:
On my home page i have all my banners in a MySQL database which includes
the image path, the link, and the description as separate fields. The
then do a MySQL query with a query that will look something like this:

$query = "select * FROM banner ORDER BY RAND() LIMIT 1";

Seems to work just fine.

just wait till you have 100000 items in that table :-)
in practice that may never happen and maybe MySQL can optimize a
SELECT that does "ORDER BY RAND() LIMIT 1"

(can anyone confirm what MySQL does with "ORDER BY RAND() LIMIT 1" exactly in terms of scanning the table? - the MySQL docs don't mention whether this is scalable at all)


Apparently a lot of folks think it's a bad idea on large tables...

http://www.google.com/search?client=safari&rls=en&q=ORDER+BY+RAND ();&ie=UTF-8&oe=UTF-8

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux