RE: [PHP-DB] Rand()

2004-10-07 Thread Ed Lazor
Hrm. Dunno then. I just manually tested it in MySQL and both approaches worked. Are you able to test directly in MySQL? Might have to go to the mysql list for this. -Ed > -Original Message- > > Yeah, I had tried that earlier but it doesn't work. It does generate > a new value for t

Re: [PHP-DB] Rand()

2004-10-07 Thread blackwater dev
Yeah, I had tried that earlier but it doesn't work. It does generate a new value for temp each time but they are still in the same order as the first one always has a lower temp value On Thu, 7 Oct 2004 06:40:23 -0700, Ed Lazor <[EMAIL PROTECTED]> wrote: > > > select id, fname, lname, RAND

RE: [PHP-DB] Rand()

2004-10-07 Thread Ed Lazor
select id, fname, lname, RAND() as temp from clients where featured=1 order by temp > -Original Message- > I have the following query: > > Select id, fname, lname from clients where featured=1 order by RAND() > > At any time, there should only be three clients where featured =1. > Prob

[PHP-DB] Rand()

2004-10-07 Thread blackwater dev
I have the following query: Select id, fname, lname from clients where featured=1 order by RAND() At any time, there should only be three clients where featured =1. Problem is I have run this query several times yet it always returns them in the same order. Not sure it makes a difference but th

Re: [PHP-DB] rand()

2004-09-30 Thread Bastien Koert
The MYI file is the index file. Is there an index on that table? From: [EMAIL PROTECTED] (Jennifer Goodie) To: blackwater dev <[EMAIL PROTECTED]> CC: [EMAIL PROTECTED], Subject: Re: [PHP-DB] rand() Date: Wed, 29 Sep 2004 23:27:43 + -- Original message from blackwat

Re: [PHP-DB] rand()

2004-09-29 Thread blackwater dev
I have no idea of it is on the server or now...I just have access to my little section of the server. Is there another way to randomly order? On Wed, 29 Sep 2004 23:27:43 +, Jennifer Goodie <[EMAIL PROTECTED]> wrote: > -- Original message from blackwater dev : -- > >

Re: [PHP-DB] rand()

2004-09-29 Thread Jennifer Goodie
-- Original message from blackwater dev : -- > select * from clients order by RAND() > > THe query runs fine on my local server but when I run it on my hosts > server, it works ok if there is only one record in the db but then > there is more than one...I get this error

[PHP-DB] rand()

2004-09-29 Thread blackwater dev
Hello, I have the following query: select * from clients order by RAND() THe query runs fine on my local server but when I run it on my hosts server, it works ok if there is only one record in the db but then there is more than one...I get this error: #1 - Can't create/write to file '/var/tmp/#

RE: [PHP-DB] Rand() Emulation

2003-06-24 Thread Boaz Yahav
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 tha

Re: [PHP-DB] Rand() Emulation

2003-06-24 Thread Gerard Samuel
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 colum

Re: [PHP-DB] Rand() Emulation

2003-06-24 Thread Jason Wong
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

Re: [PHP-DB] Rand() Emulation

2003-06-24 Thread Becoming Digital
ry/EGDXEBBWTYUU - Original Message - From: "Gerard Samuel" <[EMAIL PROTECTED]> To: "Doug Thompson" <[EMAIL PROTECTED]> Cc: "Becoming Digital" <[EMAIL PROTECTED]>; "PHP-DB" <[EMAIL PROTECTED]> Sent: Tuesday, 24 June, 2003 12

Re: [PHP-DB] Rand() Emulation

2003-06-24 Thread Gerard Samuel
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 t

RE: [PHP-DB] Rand() Emulation

2003-06-24 Thread Roedel, Mark
l [mailto:[EMAIL PROTECTED] > 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 *

Re: [PHP-DB] Rand() Emulation

2003-06-24 Thread Gerard Samuel
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 n

Re: [PHP-DB] Rand() Emulation

2003-06-24 Thread Doug Thompson
An incredible interpretation of 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). Doug On Tue, 24 Jun 2003 11:14:55 -0400, Gerard Samuel wro

Re: [PHP-DB] Rand() Emulation

2003-06-24 Thread Gerard Samuel
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 abo

Re: [PHP-DB] Rand() Emulation

2003-06-24 Thread Becoming Digital
ingdigital.com Did I help you? Want to show your thanks? www.amazon.com/o/registry/EGDXEBBWTYUU - Original Message - From: "Gerard Samuel" <[EMAIL PROTECTED]> To: "PHP-DB" <[EMAIL PROTECTED]> Sent: Tuesday, 24 June, 2003 02:56 Subject: [PHP-DB] Rand() E

[PHP-DB] Rand() Emulation

2003-06-24 Thread Gerard Samuel
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??? Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php