[PHP] Re: Random Flash Movies

2009-09-21 Thread Gary
As always, thanks for your help. Gary ""Gary"" wrote in message news:68.43.09009.cba46...@pb1.pair.com... >A question was posted on another board that the poster wanted random flash >movies to display as the page is reloaded. I posted the script below and >said I thought it could be adapted

Re: [PHP] Re: Random Unique ID

2007-03-23 Thread Richard Lynch
On Wed, March 21, 2007 5:40 pm, [EMAIL PROTECTED] wrote: > Thanks. Yes, I check for errors. But there are other types of errors > so I'd need to verify that it is a duplicate key error and, in my > ignorance, I have not yet figured out how to do that programatically. > I worry about getting into

Re: [PHP] Re: Random Unique ID

2007-03-23 Thread Satyam
abase engine that supports replication, since that's the only way to ensure keys won't get repeated over multiple servers. Satyam - Original Message - From: <[EMAIL PROTECTED]> To: Sent: Friday, March 23, 2007 7:48 PM Subject: [PHP] Re: Random Unique ID Robert C

[PHP] Re: Random Unique ID

2007-03-23 Thread ccspencer
Robert Cummings writes: Bleh, you can solve this with at most 2 queries. Thanks. That is a bit different than what I was thinking about but it might work for my purposes. Thanks also to all the other people who made suggestions. It appears to me that ther are 3 distinct approaches. 1) Ge

[PHP] Re: Random Unique ID

2007-03-22 Thread Mark
[EMAIL PROTECTED] wrote: > Hello, > > I want to add a random unique ID to a Mysql table. Collisions > are unlikely but possible so to handle those cases I'd like to > regenerate the random ID until there is no collision and only > then add my row. Any suggestions for a newbie as to the right >

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread Mark
Tijnema ! wrote: > On 3/22/07, markw@mohawksoft.com wrote: >> > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: >> >> # markw@mohawksoft.com / 2007-03-22 08:49:59 -0400: >> >> > Tijnema ! wrote: >> >> > >> >> > > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: >> >> > >> >> >> > >>

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread Tijnema !
On 3/22/07, markw@mohawksoft.com wrote: > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: >> # markw@mohawksoft.com / 2007-03-22 08:49:59 -0400: >> > Tijnema ! wrote: >> > >> > > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: >> > >> >> > >> http://www.ossp.org/pkg/lib/uuid >> > >

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread markw
> On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: >> # markw@mohawksoft.com / 2007-03-22 08:49:59 -0400: >> > Tijnema ! wrote: >> > >> > > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: >> > >> >> > >> http://www.ossp.org/pkg/lib/uuid >> > > >> > > Note that this doesn't gonna work w

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread Tijnema !
On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: # markw@mohawksoft.com / 2007-03-22 08:49:59 -0400: > Tijnema ! wrote: > > > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: > >> > >> http://www.ossp.org/pkg/lib/uuid > > > > Note that this doesn't gonna work when safe mode is on..!

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread Roman Neuhauser
# markw@mohawksoft.com / 2007-03-22 08:49:59 -0400: > Tijnema ! wrote: > > > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: > >> > >> http://www.ossp.org/pkg/lib/uuid > > > > Note that this doesn't gonna work when safe mode is on..! Ralf S. Engelschall's OSSP UUID library wrapped in a P

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread Mark
Tijnema ! wrote: > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: >> # [EMAIL PROTECTED] / 2007-03-21 21:03:35 -0500: >> > Mark wrote: >> > >[EMAIL PROTECTED] wrote: >> > > >> > >>Hello, >> > >> >> > >>I want to add a random unique ID to a Mysql table. Collisions >> > >>are unlikely but p

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread Tijnema !
On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: # [EMAIL PROTECTED] / 2007-03-21 21:03:35 -0500: > Mark wrote: > >[EMAIL PROTECTED] wrote: > > > >>Hello, > >> > >>I want to add a random unique ID to a Mysql table. Collisions > >>are unlikely but possible so to handle those cases I'd like

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-03-21 21:03:35 -0500: > Mark wrote: > >[EMAIL PROTECTED] wrote: > > > >>Hello, > >> > >>I want to add a random unique ID to a Mysql table. Collisions > >>are unlikely but possible so to handle those cases I'd like to > >>regenerate the random ID until there is no collisi

Re: [PHP] Re: Random Unique ID

2007-03-21 Thread Robert Cummings
On Thu, 2007-03-22 at 08:14 +0400, Rabih Tayyem wrote: > Actually I told you that the possibility of collision is small because I > wanted to be scientific > Scientifically, I can say this posibilty goes to 0... Only as the length of the ID approaches infinity :B Cheers, Rob. -- .---

Re: [PHP] Re: Random Unique ID

2007-03-21 Thread Rabih Tayyem
Actually I told you that the possibility of collision is small because I wanted to be scientific Scientifically, I can say this posibilty goes to 0... It is a random ID (not a totally random but based on the current timestamp) generated not only once but twice based on two different time s

[PHP] Re: Random Unique ID

2007-03-21 Thread Myron Turner
Mark wrote: [EMAIL PROTECTED] wrote: Hello, I want to add a random unique ID to a Mysql table. Collisions are unlikely but possible so to handle those cases I'd like to regenerate the random ID until there is no collision and only then add my row. Any suggestions for a newbie as to the right

[PHP] Re: Random Unique ID

2007-03-21 Thread Mark
[EMAIL PROTECTED] wrote: > Hello, > > I want to add a random unique ID to a Mysql table. Collisions > are unlikely but possible so to handle those cases I'd like to > regenerate the random ID until there is no collision and only > then add my row. Any suggestions for a newbie as to the right >

Re: [PHP] Re: Random Unique ID

2007-03-21 Thread Robert Cummings
On Wed, 2007-03-21 at 16:40 -0600, [EMAIL PROTECTED] wrote: > Jim Moseby writes: > > >> However, altho I know that by making the random number big enough > >> the likelyhood of collisions can be made vanishingly small, I was > >> actually concerned with eliminating the possibility of collisions >

[PHP] Re: Random Unique ID

2007-03-21 Thread ccspencer
Jim Moseby writes: However, altho I know that by making the random number big enough the likelyhood of collisions can be made vanishingly small, I was actually concerned with eliminating the possibility of collisions altogether by checking to see if the number had been used before. I just do

Re: [PHP] Re: Random Unique ID

2007-03-21 Thread Stut
[EMAIL PROTECTED] wrote: Stut writes: [EMAIL PROTECTED] wrote: I want to add a random unique ID to a Mysql table. Collisions are unlikely but possible so to handle those cases I'd like to regenerate the random ID until there is no collision and only then add my row. Any suggestions for a newb

RE: [PHP] Re: Random Unique ID

2007-03-21 Thread Jim Moseby
> Rabih Tayyem writes: > > > PS: I don't take credit for the code as it is a modified version of > > a code I found long time back (this same code is running on one of > > my applications for months without any problem).. > > Thanks. I'll find use for that! > > However, altho I know that by

[PHP] Re: Random Unique ID

2007-03-21 Thread ccspencer
Rabih Tayyem writes: PS: I don't take credit for the code as it is a modified version of a code I found long time back (this same code is running on one of my applications for months without any problem).. Thanks. I'll find use for that! However, altho I know that by making the random num

[PHP] Re: Random Unique ID

2007-03-21 Thread ccspencer
Stut writes: [EMAIL PROTECTED] wrote: I want to add a random unique ID to a Mysql table. Collisions are unlikely but possible so to handle those cases I'd like to regenerate the random ID until there is no collision and only then add my row. Any suggestions for a newbie as to the right way to

[PHP] Re: Random Record Retrieval

2004-05-23 Thread Martin Geisler
[EMAIL PROTECTED] (Robb Kerr) writes: > How's that for alliteration in a subject line? Very nice! :-) > [...] And, if this is the best way to go, unfortunately I don't > know how to write a random number generator in PHP so would > appreciate any help. Your idea sounds good, and luckily you do

[PHP] Re: random?

2004-01-29 Thread Rob Adams
"Chris" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > $sql = "SELECT * FROM agentdb WHERE ((OfficeID <> 214) and > (agentdb.agent_id<> 1115421) and (agentdb.agent_id > 100) and > agentdb.agent_id <> 333)) ORDER BY RAND() LIMIT 1"; > > The above code should generate a random

Re: [PHP] Re: Random Numbers..

2003-12-08 Thread Curt Zirzow
* Thus wrote Burrito Warrior ([EMAIL PROTECTED]): > > This would: > /* selecting a random record, where n = 1. Works fine on small tables */ > mysql> SELECT value FROM table ORDER BY RAND() LIMIT n; > > /* selecting a random record. This is good on large tables if numbering > sequence is used *

[PHP] Re: Random Numbers..

2003-12-07 Thread Luke
select all and use mysql_data_seek($result, rand(mysql_num_rows($result) - 1)); $row = mysql_fetch_assoc($result); and there, your random row is returnd, that should be easy enough :) and it should work -- Luke "Theheadsage" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hey, > >

RE: [PHP] Re: Random Numbers..

2003-12-06 Thread Burrito Warrior
CTED] Subject: [PHP] Re: Random Numbers.. Theheadsage wrote: > Hey, > > I've got a script which used to generate a random quote. It worked fine > untill this problem occurred.. > > Say we have 4 quotes with QuoteID's of 1 through to 4 > The script would grab a number

[PHP] Re: Random Numbers..

2003-12-06 Thread Alex
Theheadsage wrote: Hey, I've got a script which used to generate a random quote. It worked fine untill this problem occurred.. Say we have 4 quotes with QuoteID's of 1 through to 4 The script would grab a number of rows, and generate a random number between 1 and this value (being 4 in this case)

[PHP] Re: Random Quotes...

2003-10-22 Thread Kevin Stone
"Payne" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I am working on a project and I need to see sample quote for doing > random quotes. These quotes will be put from a database. Can some please > share me some sample code. Thanks. > > Chuck For more solutions go to,

[PHP] Re: Random Image Store

2003-06-11 Thread Hugh Bothwell
"Monil Chheda" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I want to create an php system that prevents automated > registrations. > > I have come up with the script in which users come > over and need to enter a random key displayed on the > images while submitting their info. If

RE: [PHP] Re: Random numbers in a cronned script?

2002-09-13 Thread Martin Towell
51 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: Random numbers in a cronned script? Yes, you're right about that point since the seed in most cases is computed from system time => increasing probability of having same number @ the same request time... you can change the seed with the time()

[PHP] Re: Random numbers in a cronned script?

2002-09-13 Thread lallous
Yes, you're right about that point since the seed in most cases is computed from system time => increasing probability of having same number @ the same request time... you can change the seed with the time() too (not all days are the same). hope to hear others' opinions too. Elias "Leif K-Brook

[PHP] Re: Random Passwords Generator

2002-08-17 Thread Manuel Lemos
Hello, On 08/18/2002 01:51 AM, César aracena wrote: > Hi all. I know there must be several ways of doing this but I wonder > what the best solution is. I'm tired of making and looking at scripts > that creates random passwords for users from a "words.txt" list. These > kind of passwords are limit

[PHP] Re: Random mirrors and download quota

2002-08-11 Thread B.C. Lance
how about using the counter to store an id of the mirrors instead of randomly picking one? this will provide you a sequential traverse through all mirror sites. if there are 10 sites, the counter will always be from 0 -> 9. this way each mirror site will have equal share on hits. so if the cou

[PHP] Re: Random mirrors and download quota

2002-08-11 Thread Julio Nobrega
Seems good to me, only this part: > and it will be checked if the mirror is randomly selected and > if it is above 1200, will randomly select another server It's better to select those under 1200 right from the start. If you have 10 servers, you might make 9 checks before selecting the last on

[PHP] Re: Random number Question

2002-04-29 Thread Dan Koken
OOPS! You are right on.. I noticed my error after I sent it. The name='guess' was on the input.?? Daaa! it's Monday .. OK!! This should work: === The computer has picked $another number between 1 and 10. Guess the number and you win! Enter your gu

[PHP] Re: Random number Question

2002-04-29 Thread Dan Koken
Try something like this and see if it works??? The computer has picked $another number between 1 and 10. Guess the number and you win! Enter your guess: "; if (isset($guess)) { srand((double)microtime()*100); $number =

[PHP] Re: Random number Question

2002-04-18 Thread Joel Colombo
actually if (intval($guess) == $number { would be more acuate then the trim ( ) you would eliminate all alpha characters and floating points saying it has to be a whole integer Joel "Ralph Friedman" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > In ar

[PHP] Re: Random number Question

2002-03-13 Thread Ralph Friedman
In article <[EMAIL PROTECTED]>, Jennifer Downey wrote: > > > you've got the "Name" attribute attached to the wrong INPUT element: > if($guess = = $number) { > incorrect syntax here. that should be: if ($guess == $number) { better would be: if (trim($guess) == $number { this will

[PHP] Re: Random Selecting from mySQL

2002-03-13 Thread Julio Nobrega Trabalhando
You could store the results in a session var to carry along the pages. Then on the second just retrieve them. Or maybe a second table with this info. Give each search an ID and store the results there. It would be easy to implement: INSERT INTO table ('',field) SELECT field FROM table ORDER

Re: Re: [PHP] Re: Random

2001-12-19 Thread David
yeah, my linux(Mandrake 8, Apache 1.3.22, PHP 4.1.0) box also gives me a 6 digit integer each time too. but when i tried on my win32 (Win2k, Apache 1.3.22, PHP 4.1.0), it is limited to a max of 32767 as indicated with getrandmax(). the origional author of the problem probably using windows to

Re: [PHP] Re: Random

2001-12-19 Thread Knut H. Hassel Nielsen
On 19 Dec 2001, David wrote: > should be because rand() can\'t generate such a large number for u. > > use $max_random_number = getrandmax(); to check > > http://sg.php.net/manual/en/function.getrandmax.php Hmmm... My webserver gives me no problems witht this at all. (Sun E250 with Solaris 8, A

[PHP] Re: Random

2001-12-19 Thread David
should be because rand() can\'t generate such a large number for u. use $max_random_number = getrandmax(); to check http://sg.php.net/manual/en/function.getrandmax.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:

[PHP] Re: random images fom db

2001-11-16 Thread Joe Van Meer
Got it...if anyone's interested the code is below :) /connect to db $connectionToDBid = odbc_connect("codesnipits", "joecode", "joecode"); // sql statement $sqlb = "SELECT imagepath FROM IMAGES"; / run the query and dump into $numberofrecords variable $row = odbc_do($connectionToDBid, $sqlb);

[PHP] Re: Random

2001-10-28 Thread _lallous
$ceiling is too big. try to do this and see: echo getrandmax(); you might get 32767 as an output! therefore, $ceiling must be <= getrandmax(); try to scale down your floor and ceiling, ie: $max = $ceiling - $floor; $random = rand(0, $max) + $floor; "Andrew Duck" <[EMAIL PROTECTED]> wrote in me

[PHP] Re: random numbers help

2001-10-05 Thread Richard Lynch
You should call mt_srand((double) microtime() * 100) once, and only once, in any given script. -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmus

[PHP] Re: random numbers help

2001-10-05 Thread Henrik Hansen
[EMAIL PROTECTED] (Nikola Veber) wrote: > Hi ! > I'm having troubles with the random numbers. When I create a number witm mt_rand() > I always get the same number on my local server. I need this stuff to ranomly >display > some text, and I'd like to have another value of the random number

[PHP] Re: Random number

2001-08-30 Thread Hugh Bothwell
"Rosen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > I'm using PHP code from manual: > srand( (double) microtime() * 100); > // Get random User ID > $uid=rand(); > > but it dowsn't work ! ... I would make sure that microtime() is doing what you th

[PHP] Re: RANDOM

2001-08-09 Thread Richard Lynch
>Could somebody please show me, send me an example or redirect me to a page which shows how to >show a random FLASH movie from a text file which contains different names of different movies >so that when i go on the page it shows lets say, 1 of the 5 movies in the text document. "; ?> There's a