PROTECTED]
Sent: Tuesday, June 24, 2003 6:19 PM
To: Doug Thompson
Cc: Becoming Digital; PHP-DB
Subject: Re: [PHP-DB] Rand() Emulation
Im probably not making myself clear.
Ultimately, my goal is to emulate mysql's -
SELECT * FROM TABLE ORDER BY RAND() LIMIT (X)
for other databases that do
Im trying to figure out a way to emulate mysql's RAND() function to be
cross database compatible via php.
Has anyone done anything similar to this???
How about PHP's rand() function?
http://us2.php.net/manual/en/function.rand.php
Edward Dudlik
Becoming Digital
www.becomingdigital.com
Did I
Doesn't really cut it when you do not know a min and max value, or want
to extract a random range of numbers.
Becoming Digital wrote:
Im trying to figure out a way to emulate mysql's RAND() function to be
cross database compatible via php.
Has anyone done anything similar to this???
How
An incredible interpretation of
quote
If called without the optional min, max arguments rand() returns a pseudo-random value
between 0 and RAND_MAX. If you want a random number between 5 and 15 (inclusive), for
example, use rand (5, 15).
/quote
Doug
On Tue, 24 Jun 2003 11:14:55 -0400,
Im probably not making myself clear.
Ultimately, my goal is to emulate mysql's -
SELECT * FROM TABLE ORDER BY RAND() LIMIT (X)
for other databases that do not support RAND(). So using variations of
php's rand(), wouldn't make sense,
as it only picks one value out of a range of values, that are
]
Sent: Tuesday, June 24, 2003 11:19 AM
To: Doug Thompson
Cc: Becoming Digital; PHP-DB
Subject: Re: [PHP-DB] Rand() Emulation
Im probably not making myself clear.
Ultimately, my goal is to emulate mysql's -
SELECT * FROM TABLE ORDER BY RAND() LIMIT (X)
for other databases that do
Yes its more than possible to do as you suggested, but as you implied,
not very friendly,
when it comes to large result sets...
Roedel, Mark wrote:
Might it be simpler, since you're assuming the presence of PHP anyway,
to just read your entire result set into an array and then shuffle() it
and
Samuel [EMAIL PROTECTED]
To: Doug Thompson [EMAIL PROTECTED]
Cc: Becoming Digital [EMAIL PROTECTED]; PHP-DB
[EMAIL PROTECTED]
Sent: Tuesday, 24 June, 2003 12:19
Subject: Re: [PHP-DB] Rand() Emulation
Im probably not making myself clear.
Ultimately, my goal is to emulate mysql's -
SELECT * FROM
On Wednesday 25 June 2003 00:19, Gerard Samuel wrote:
Im probably not making myself clear.
Ultimately, my goal is to emulate mysql's -
SELECT * FROM TABLE ORDER BY RAND() LIMIT (X)
for other databases that do not support RAND(). So using variations of
php's rand(), wouldn't make sense,
as
Becoming Digital wrote:
Ultimately, my goal is to emulate mysql's -
SELECT * FROM TABLE ORDER BY RAND() LIMIT (X)
for other databases that do not support RAND().
Which are those?
Currently mySQL, PostgreSQL, and MSSQL.
To me the idea above would work, but it hinges on if that rand
10 matches
Mail list logo