Re: [PHP] using rand()

2005-04-07 Thread Ryan A
> why not do two select statements using the ORDER BY RAND() then append: > > LIMIT 3 for your women, > > and then > > LIMIT 1 for your men > > > > so the first one is: > > $result1 = > mysql_query("select * from {table} where sex='female' order > by rand() limit 3;"); > > the second: > > $result

[PHP] using rand()

2005-04-07 Thread Ryan A
Hey, need some advise on what would be the best way to do this: I have a table with these fields: cno (just a auto_increment field), username, sex (2 values: man, woman), has_pic (0=no,1=yes), pic_name I need to randomly get 3 womens pictures and one guys picture from the above table... I know I

Re: [PHP] Using rand() for 10 digit numbers????

2003-09-05 Thread Curt Zirzow
* Thus wrote Scott Fletcher ([EMAIL PROTECTED]): > How interesting. Yours work while mine doesn't. All I did was .. > > --snip-- > $randomNumber = rand(0,99); > echo $randomNumber; > --snip-- > > What PHP version do you use? I only have version 4.3.1 on the machine. I believe its the

Re: [PHP] Using rand() for 10 digit numbers????

2003-09-05 Thread Scott Fletcher
Continue(ing) of this replying go into the title, 'Very Interesting'. "Scott Fletcher" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Very Interesting. I tried your code on my machine and I got this... > > --snip-- > 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > 0 0 0 0 0 0

Re: [PHP] Using rand() for 10 digit numbers????

2003-09-05 Thread Scott Fletcher
Very Interesting. I tried your code on my machine and I got this... --snip-- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

RE: [PHP] Using rand() for 10 digit numbers????

2003-09-05 Thread Jay Blanchard
[snip] What PHP version do you use? I only have version 4.3.1 on the machine. [/snip] Did this on a 4.2.1 and a 4.3...no probs. Have you tried the code I posted on your machine? 0){ $random=rand (0,9); echo number_format($random, 0, '', ',')."\n"; $i--; } ?> -- PHP General Mail

Re: [PHP] Using rand() for 10 digit numbers????

2003-09-05 Thread Scott Fletcher
Could be "Robert Cummings" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > It probably wraps the standard C rand() function which only takes an > unsigned integer which is usually 16 bits. > > Cheers, > Rob. > > On Fri, 2003-09-05 at 12:34, Scott Fletcher wrote: > > Hi! > > > >

Re: [PHP] Using rand() for 10 digit numbers????

2003-09-05 Thread Scott Fletcher
How interesting. Yours work while mine doesn't. All I did was .. --snip-- $randomNumber = rand(0,99); echo $randomNumber; --snip-- What PHP version do you use? I only have version 4.3.1 on the machine. "Jay Blanchard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] [snip]

RE: [PHP] Using rand() for 10 digit numbers????

2003-09-05 Thread Jay Blanchard
[snip] I looked at the rand() at php.net which spoke about min and max random number. So, I use rand(0,99) to get a 10 digit random number but it only return an 1 digit random number that is displayed at '0'. So, I tried rand(0,) with 4 digit random number and got the random numbe

Re: [PHP] Using rand() for 10 digit numbers????

2003-09-05 Thread Robert Cummings
It probably wraps the standard C rand() function which only takes an unsigned integer which is usually 16 bits. Cheers, Rob. On Fri, 2003-09-05 at 12:34, Scott Fletcher wrote: > Hi! > > I looked at the rand() at php.net which spoke about min and max random > number. So, I use rand(0,999

[PHP] Using rand() for 10 digit numbers????

2003-09-05 Thread Scott Fletcher
Hi! I looked at the rand() at php.net which spoke about min and max random number. So, I use rand(0,99) to get a 10 digit random number but it only return an 1 digit random number that is displayed at '0'. So, I tried rand(0,) with 4 digit random number and got the random number.