Re: [PHP] Random

2013-05-24 Thread Last Hacker Always onpoint
I needed something like this echo(rand(1,30)) On 5/24/13, Last Hacker Always onpoint lasthack...@gmail.com wrote: okay thanks tamouse and others you think am not on point hmmm? I'll show you i am. On 5/24/13, tamouse mailing lists tamouse.li...@gmail.com wrote: On Thu, May 23, 2013 at 3:51

Re: [PHP] Random

2013-05-24 Thread Ashley Sheridan
Last Hacker Always onpoint lasthack...@gmail.com wrote: I needed something like this echo(rand(1,30)) On 5/24/13, Last Hacker Always onpoint lasthack...@gmail.com wrote: okay thanks tamouse and others you think am not on point hmmm? I'll show you i am. On 5/24/13, tamouse mailing lists

Re: [PHP] Random

2013-05-24 Thread Nick Pratley
Lola On Friday, May 24, 2013, Ashley Sheridan wrote: Last Hacker Always onpoint lasthack...@gmail.com javascript:; wrote: I needed something like this echo(rand(1,30)) On 5/24/13, Last Hacker Always onpoint lasthack...@gmail.comjavascript:; wrote: okay thanks tamouse and others you

Re: [PHP] Random

2013-05-24 Thread Jim Giner
On 5/24/2013 3:04 AM, Last Hacker Always onpoint wrote: I needed something like this echo(rand(1,30)) On 5/24/13, Last Hacker Always onpoint lasthack...@gmail.com wrote: okay thanks tamouse and others you think am not on point hmmm? I'll show you i am. On 5/24/13, tamouse mailing lists

Re: [PHP] Random

2013-05-23 Thread Stuart Dallas
On 23 May 2013, at 21:51, Last Hacker Always onpoint lasthack...@gmail.com wrote: Hey I need code for random number 1-30 for my site. Seriously? Did you try to find out how to do this yourself before asking here? http://php.net/rand And, more generally: http://php.net/docs -Stuart --

Re: [PHP] Random

2013-05-23 Thread Daniel Brown
On Thu, May 23, 2013 at 4:51 PM, Last Hacker Always onpoint lasthack...@gmail.com wrote: Hey I need code for random number 1-30 for my site. You need to know that you've been removed from the list (but you'd still have to be subscribed to be able to read this). -- /Daniel P. Brown Network

Re: [PHP] Random

2013-05-23 Thread Tedd Sperling
On May 23, 2013, at 4:54 PM, Daniel Brown danbr...@php.net wrote: On Thu, May 23, 2013 at 4:51 PM, Last Hacker Always onpoint lasthack...@gmail.com wrote: Hey I need code for random number 1-30 for my site. You need to know that you've been removed from the list (but you'd still have to

Re: [PHP] Random

2013-05-23 Thread Stephen
On 13-05-23 04:51 PM, Last Hacker Always onpoint wrote: Hey I need code for random number 1-30 for my site. http://php.net/manual/en/function.rand.php -- Stephen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Random

2013-05-23 Thread musicdev
His gmail name should be Last last last last Hacker hacker acker not-cker Never On-point :) On Thu, May 23, 2013 at 4:51 PM, Last Hacker Always onpoint lasthack...@gmail.com wrote: Hey I need code for random number 1-30 for my site. -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Random

2013-05-23 Thread tamouse mailing lists
On Thu, May 23, 2013 at 3:51 PM, Last Hacker Always onpoint lasthack...@gmail.com wrote: Hey I need code for random number 1-30 for my site. function rand_from_1_to_30() { return 4; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Random

2013-05-23 Thread Last Hacker Always onpoint
okay thanks tamouse and others you think am not on point hmmm? I'll show you i am. On 5/24/13, tamouse mailing lists tamouse.li...@gmail.com wrote: On Thu, May 23, 2013 at 3:51 PM, Last Hacker Always onpoint lasthack...@gmail.com wrote: Hey I need code for random number 1-30 for my site.

Re: [PHP] Random 404 screens

2013-02-10 Thread Jim Giner
On 2/9/2013 11:58 AM, Mike Mackintosh wrote: On Saturday, February 9, 2013 at 11:51 AM, Geoff Shang wrote: On Sat, 9 Feb 2013, Jim Giner wrote: Lately, my web pages are giving me some problems. Once a day or so one or more of my pages/scripts will give me a 404 error page saying my web

Re: [PHP] Random 404 screens

2013-02-10 Thread Andy McKenzie
On Sat, Feb 9, 2013 at 11:51 AM, Geoff Shang ge...@quitelikely.com wrote: On Sat, 9 Feb 2013, Jim Giner wrote: Lately, my web pages are giving me some problems. Once a day or so one or more of my pages/scripts will give me a 404 error page saying my web page has timed out. Problem is that

Re: [PHP] Random 404 screens

2013-02-10 Thread Jim Giner
On 2/10/2013 12:45 PM, Andy McKenzie wrote: On Sat, Feb 9, 2013 at 11:51 AM, Geoff Shang ge...@quitelikely.com wrote: On Sat, 9 Feb 2013, Jim Giner wrote: Lately, my web pages are giving me some problems. Once a day or so one or more of my pages/scripts will give me a 404 error page saying

Re: [PHP] Random 404 screens

2013-02-10 Thread Matijn Woudt
On Sun, Feb 10, 2013 at 6:53 PM, Jim Giner jim.gi...@albanyhandball.comwrote: On 2/10/2013 12:45 PM, Andy McKenzie wrote: On Sat, Feb 9, 2013 at 11:51 AM, Geoff Shang ge...@quitelikely.com wrote: On Sat, 9 Feb 2013, Jim Giner wrote: Lately, my web pages are giving me some problems. Once

Re: [PHP] Random 404 screens

2013-02-10 Thread Jim Giner
Im pretty sure its not a script error cause it always works a second later jg On Feb 10, 2013, at 2:48 PM, Matijn Woudt tijn...@gmail.com wrote: On Sun, Feb 10, 2013 at 6:53 PM, Jim Giner jim.gi...@albanyhandball.com wrote: On 2/10/2013 12:45 PM, Andy McKenzie wrote: On Sat, Feb 9,

Re: [PHP] Random 404 screens

2013-02-09 Thread Andy McKenzie
On Sat, Feb 9, 2013 at 10:41 AM, Jim Giner jim.gi...@albanyhandball.com wrote: This is a tough one. Lately, my web pages are giving me some problems. Once a day or so one or more of my pages/scripts will give me a 404 error page saying my web page has timed out. Problem is that the page was

Re: [PHP] Random 404 screens

2013-02-09 Thread Jim Giner
On 2/9/2013 11:21 AM, Andy McKenzie wrote: Smart money is that it's nothing to do with you; in my experience, that's usually a network problem. It could be on your end (I'm seeing that a lot more often now that I've moved to a new house, or it could be a problem with the server's connection.

Re: [PHP] Random 404 screens

2013-02-09 Thread Geoff Shang
On Sat, 9 Feb 2013, Jim Giner wrote: Lately, my web pages are giving me some problems. Once a day or so one or more of my pages/scripts will give me a 404 error page saying my web page has timed out. Problem is that the page was just displayed. I click on a link, the page shows up, I click

Re: [PHP] Random 404 screens

2013-02-09 Thread Mike Mackintosh
On Saturday, February 9, 2013 at 11:51 AM, Geoff Shang wrote: On Sat, 9 Feb 2013, Jim Giner wrote: Lately, my web pages are giving me some problems. Once a day or so one or more of my pages/scripts will give me a 404 error page saying my web page has timed out. Problem is that the

Re: [PHP] Random Flash Movies

2009-09-20 Thread Ashley Sheridan
On Sun, 2009-09-20 at 11:30 -0400, Gary wrote: 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 but that the echo would probably need to change. Can

Re: [PHP] Random Flash Movies

2009-09-20 Thread Eddie Drapkin
On Sun, Sep 20, 2009 at 11:33 AM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Sun, 2009-09-20 at 11:30 -0400, Gary wrote: 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

Re: [PHP] Random php

2009-04-11 Thread Phpster
On Apr 11, 2009, at 10:12, Gary gwp...@ptd.net wrote: Is there a way to have a php include called ramdomly? For example, I have an area that I am using to show various quotes and I would like the quotes to be ramdom. Thanks for your help Gary -- PHP General Mailing List

Re: [PHP] Random php

2009-04-11 Thread Gary
Thanks much for your quick reply, I'll take a look (and maybe even find one that spell checks my posts first!). Gary Phpster phps...@gmail.com wrote in message news:146a4da4-0114-474c-92f8-b8d3a5ecc...@gmail.com... On Apr 11, 2009, at 10:12, Gary gwp...@ptd.net wrote: Is there a way to

Re: [PHP] Random php

2009-04-11 Thread Gary
I had been on that site before, but seems like it is a breeding ground for spam and links to free commercial sites. Ran into a few bad or broken links, several listings as different scripts only to take you to the same best price hosting company with no scripts at all. Is this common, is

Re: [PHP] Random php

2009-04-11 Thread 9el
On Sun, Apr 12, 2009 at 1:32 AM, Gary gwp...@ptd.net wrote: I had been on that site before, but seems like it is a breeding ground for spam and links to free commercial sites. Ran into a few bad or broken links, several listings as different scripts only to take you to the same best price

Re: [PHP] Random number generator

2008-11-06 Thread Amisha_Sharma
Hi you can use PHP rand() function for selecting a random number between 1 to 100. http://www.senpai-it.com/dedicated_servers.php Senpai IT Solutions Dedicated Server at low cost WEISD wrote: On a php web page I want to generate a random number between say 1 and 10 and then use that

Re: [PHP] Random number generator

2008-11-06 Thread Daniel P. Brown
On Thu, Nov 6, 2008 at 3:52 AM, Amisha_Sharma [EMAIL PROTECTED] wrote: Hi you can use PHP rand() function for selecting a random number between 1 to 100. Amisha, Welcome to the list, but please don't top post. For a list of all the guidelines for the official PHP lists, including

Re: [PHP] Random number generator

2008-11-06 Thread Andrew Ballard
On Thu, Nov 6, 2008 at 10:53 AM, WEISD [EMAIL PROTECTED] wrote: Gary M. Josack [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Stephen wrote: On a php web page I want to generate a random number between say 1 and 10 and then use that number to reference a particular file in an

Re: [PHP] Random number generator

2008-11-06 Thread WEISD
Gary M. Josack [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Stephen wrote: On a php web page I want to generate a random number between say 1 and 10 and then use that number to reference a particular file in an include tag. ?php include('GeneratedNumber.html'); ? Is there an

RE: [PHP] Random number generator

2008-11-06 Thread Jay Blanchard
[snip] ?php $number = rand(1, 10); include(footer$number.html); ? You can see it in action here at the bottom of the page there is a footer. Each footer is the same right now except I have numbered them for testing. As I refresh the page, I get footer10 almost always with an occasional 2 or

Re: [PHP] Random number generator

2008-11-06 Thread Stephen
On Thu, 11/6/08, WEISD [EMAIL PROTECTED] wrote: That is strange. I get pretty balanced results on this computer. ?php $histogram = array_fill(1, 10, 0); $iterations = 20; for ($i = 0; $i $iterations; ++$i) { ++$histogram[round(rand(1, 10))]; }

Re: [PHP] Random number generator

2008-11-06 Thread Micah Gersten
WEISD wrote: That is strange. I get pretty balanced results on this computer. ?php $histogram = array_fill(1, 10, 0); $iterations = 20; for ($i = 0; $i $iterations; ++$i) { ++$histogram[round(rand(1, 10))]; } print_r($histogram); ? Andrew Simple code, ?php $number =

Re: [PHP] Random number generator

2008-11-06 Thread WEISD
Computer functions to generate random numbers are not designed to do what their name suggests. Software testing requires repeatability, and this includes random number generation. Without knowing how PHP seeds the generator it is difficult to predict what it will do. I still think

Re: [PHP] Random number generator

2008-11-06 Thread WEISD
That is strange. I get pretty balanced results on this computer. ?php $histogram = array_fill(1, 10, 0); $iterations = 20; for ($i = 0; $i $iterations; ++$i) { ++$histogram[round(rand(1, 10))]; } print_r($histogram); ? Andrew Simple code, ?php $number = rand(1, 10);

Re: [PHP] Random number generator

2008-11-06 Thread Maciek Sokolewicz
WEISD wrote: Computer functions to generate random numbers are not designed to do what their name suggests. Software testing requires repeatability, and this includes random number generation. Without knowing how PHP seeds the generator it is difficult to predict what it will do. I

Re: [PHP] Random number generator

2008-11-06 Thread Jim Lucas
WEISD wrote: Computer functions to generate random numbers are not designed to do what their name suggests. Software testing requires repeatability, and this includes random number generation. Without knowing how PHP seeds the generator it is difficult to predict what it will do. I

Re: [PHP] Random number generator

2008-11-06 Thread tedd
At 10:30 AM -0600 11/6/08, WEISD wrote: You can see it in action here at the bottom of the page there is a footer. Each footer is the same right now except I have numbered them for testing. As I refresh the page, I get footer10 almost always with an occasional 2 or 4 here and there...

Re: [PHP] Random number generator

2008-11-06 Thread WEISD
http://www.weisd.com/store2/WINHD-9022.php Not me -- I get a normal distribution. Cheers, tedd Thanks Tedd, That is because it is using time now and not rand... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Random number generator

2008-11-06 Thread Micah Gersten
Stephen wrote: On Thu, 11/6/08, WEISD [EMAIL PROTECTED] wrote: That is strange. I get pretty balanced results on this computer. ?php $histogram = array_fill(1, 10, 0); $iterations = 20; for ($i = 0; $i $iterations; ++$i) { ++$histogram[round(rand(1, 10))]; }

Re: [PHP] Random number generator

2008-11-06 Thread WEISD
1. change the number to a string: $t = (string) time(); 2. chop off the last char of the string: $char = substr($t, -1); 3. you're done...: include footer$char.html; Time wins certainly produces better results, at least for what I am doing, than rand... Thanks all for your input...

Re: [PHP] Random number generator

2008-11-06 Thread tedd
At 11:35 AM -0600 11/6/08, WEISD wrote: http://www.weisd.com/store2/WINHD-9022.php Not me -- I get a normal distribution. Cheers, tedd Thanks Tedd, That is because it is using time now and not rand... Just as point of notice. When I ask a question and provide a url, I keep the url

Re: [PHP] Random number generator

2008-11-05 Thread Stephen
On a php web page I want to generate a random number between say 1 and 10 and then use that number to reference a particular file in an include tag. ?php include('GeneratedNumber.html'); ? Is there an easy way to do this? Get the time and use the last digit converting 0 to 10.

Re: [PHP] Random number generator

2008-11-05 Thread TG
Here's how you generate a random number: http://us.php.net/manual/en/function.rand.php There are a number of things you can do with that to select a random file and include it. Have an associative array where the random number matches an array key and the value is the filename you want, is one

Re: [PHP] Random number generator

2008-11-05 Thread WEISD
Just starting out, thanks. So, ?php $number = rand(1, 10); include('$number.html'); ? I should have prefaced the question with, New to PHP... TG [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Here's how you generate a random number:

Re: [PHP] Random number generator

2008-11-05 Thread Gary M. Josack
Stephen wrote: On a php web page I want to generate a random number between say 1 and 10 and then use that number to reference a particular file in an include tag. ?php include('GeneratedNumber.html'); ? Is there an easy way to do this? Get the time and use the last digit converting 0

Re: [PHP] Random number generator

2008-11-05 Thread Gary M. Josack
WEISD wrote: Just starting out, thanks. So, ?php $number = rand(1, 10); include('$number.html'); ? I should have prefaced the question with, New to PHP... TG [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Here's how you generate a random number:

Re: [PHP] Random number generator

2008-11-05 Thread Nitsan Bin-Nun
Umm I must notify you, just in case you don't know this, that you have to be aware of the fact that the humanity haven't found a way to get a random number (yet. they are working on it while I'm writing this..) (; On Wed, Nov 5, 2008 at 9:43 PM, Gary M. Josack [EMAIL PROTECTED] wrote: WEISD

Re: [PHP] Random number generator

2008-11-05 Thread Ashley Sheridan
On Wed, 2008-11-05 at 12:41 -0600, WEISD wrote: On a php web page I want to generate a random number between say 1 and 10 and then use that number to reference a particular file in an include tag. ?php include('GeneratedNumber.html'); ? Is there an easy way to do this? Thanks

Re: [PHP] Random SELECT SQL list

2007-05-20 Thread Eduardo Vizcarra
Hi Larry,Paul,Zoltán Thanks for your messages, adding ORDER BY RAND () worked just fine :) Eduardo Larry Garfield [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] On Wednesday 16 May 2007, Eduardo Vizcarra wrote: Hi I would like to know if a SELECT SQL query list of records

Re: [PHP] Random SELECT SQL list

2007-05-17 Thread Zoltán Németh
2007. 05. 17, csütörtök keltezéssel 00.45-kor Larry Garfield ezt írta: On Wednesday 16 May 2007, Eduardo Vizcarra wrote: Hi I would like to know if a SELECT SQL query list of records can be unsorted. SELECT statement retrieves a list of records from a certain table starting from

Re: [PHP] Random SELECT SQL list

2007-05-16 Thread Paul Novitski
At 5/16/2007 09:40 PM, Eduardo Vizcarra wrote: I would like to know if a SELECT SQL query list of records can be unsorted. SELECT statement retrieves a list of records from a certain table starting from record # 1 till record #N and when publishing the records, this is how it is presented, in a

Re: [PHP] Random SELECT SQL list

2007-05-16 Thread Larry Garfield
On Wednesday 16 May 2007, Eduardo Vizcarra wrote: Hi I would like to know if a SELECT SQL query list of records can be unsorted. SELECT statement retrieves a list of records from a certain table starting from record # 1 till record #N and when publishing the records, this is how it is

Re: [PHP] Random Unique ID

2007-03-24 Thread Jim McIntyre
IIRC, the OP wanted to generate a unique key precisely to keep from revealing the record ID to the end user... what about taking the auto_increment value (easy to generate, assured to be unique) adding its MD5 hash to another column in the table, then using that as the published ID? The only

Re: [PHP] Random Unique ID

2007-03-24 Thread Robert Cummings
On Sat, 2007-03-24 at 08:24 -0400, Jim McIntyre wrote: IIRC, the OP wanted to generate a unique key precisely to keep from revealing the record ID to the end user... what about taking the auto_increment value (easy to generate, assured to be unique) adding its MD5 hash to another column in the

Re: [PHP] Random Unique ID

2007-03-23 Thread Németh Zoltán
2007. 03. 22, csütörtök keltezéssel 12.58-kor tedd ezt írta: At 4:53 PM +0100 3/22/07, Németh Zoltán wrote: 2007. 03. 22, csütörtök keltezéssel 11.42-kor tedd ezt írta: As for efficiency, that's probably not even worth mentioning in this case. why not? you would use 2 sql queries

Re: [PHP] Random Unique ID

2007-03-23 Thread Robert Cummings
On Fri, 2007-03-23 at 09:15 +0100, Németh Zoltán wrote: // method 2 $time = microtime(TRUE); for ($i = 1; $i = 5000; $i++) { $done = FALSE; while (!$done) { $id = md5((microtime(TRUE) * (rand(1,1000) / 100))); $sql = INSERT INTO idtest (id,cnt)

Re: [PHP] Random Unique ID

2007-03-23 Thread Németh Zoltán
2007. 03. 23, péntek keltezéssel 08.13-kor Robert Cummings ezt írta: On Fri, 2007-03-23 at 09:15 +0100, Németh Zoltán wrote: // method 2 $time = microtime(TRUE); for ($i = 1; $i = 5000; $i++) { $done = FALSE; while (!$done) { $id = md5((microtime(TRUE) *

Re: [PHP] Random Unique ID

2007-03-23 Thread tedd
At 9:15 AM +0100 3/23/07, Németh Zoltán wrote: 2007. 03. 22, csütörtök keltezéssel 12.58-kor tedd ezt írta: At 4:53 PM +0100 3/22/07, Németh Zoltán wrote: 2007. 03. 22, csütörtök keltezéssel 11.42-kor tedd ezt írta: As for efficiency, that's probably not even worth mentioning in this

Re: [PHP] Random Unique ID

2007-03-23 Thread Németh Zoltán
2007. 03. 23, péntek keltezéssel 15.13-kor tedd ezt írta: At 9:15 AM +0100 3/23/07, Németh Zoltán wrote: 2007. 03. 22, csütörtök keltezéssel 12.58-kor tedd ezt írta: At 4:53 PM +0100 3/22/07, Németh Zoltán wrote: 2007. 03. 22, csütörtök keltezéssel 11.42-kor tedd ezt írta: As for

Re: [PHP] Random Unique ID

2007-03-23 Thread Richard Lynch
Use auto_increment. It's not random, but you should never show it to the end user anyway, so who cares? Another option is to use http://php.net/uniqid and you can create a UNIQUE INDEX on the column and simply check mysql_errno() to see if it's 1023 (or is it 2023?) when you insert to see if you

Re: [PHP] Random Unique ID

2007-03-22 Thread tedd
At 11:18 AM -0600 3/21/07, [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

Re: [PHP] Random Unique ID

2007-03-22 Thread Németh Zoltán
2007. 03. 22, csütörtök keltezéssel 11.24-kor tedd ezt írta: At 11:18 AM -0600 3/21/07, [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

Re: [PHP] Random Unique ID

2007-03-22 Thread tedd
At 4:28 PM +0100 3/22/07, Németh Zoltán wrote: 2007. 03. 22, csütörtök keltezéssel 11.24-kor tedd ezt írta: At 11:18 AM -0600 3/21/07, [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] Random Unique ID

2007-03-22 Thread Németh Zoltán
2007. 03. 22, csütörtök keltezéssel 11.42-kor tedd ezt írta: At 4:28 PM +0100 3/22/07, Németh Zoltán wrote: 2007. 03. 22, csütörtök keltezéssel 11.24-kor tedd ezt írta: At 11:18 AM -0600 3/21/07, [EMAIL PROTECTED] wrote: Hello, I want to add a random unique ID to a Mysql table.

Re: [PHP] Random Unique ID

2007-03-22 Thread tedd
At 4:53 PM +0100 3/22/07, Németh Zoltán wrote: 2007. 03. 22, csütörtök keltezéssel 11.42-kor tedd ezt írta: As for efficiency, that's probably not even worth mentioning in this case. why not? you would use 2 sql queries while I would use one most of the time and 2 in case of already reserved

Re: [PHP] Random Unique ID

2007-03-22 Thread Németh Zoltán
2007. 03. 22, csütörtök keltezéssel 12.58-kor tedd ezt írta: At 4:53 PM +0100 3/22/07, Németh Zoltán wrote: 2007. 03. 22, csütörtök keltezéssel 11.42-kor tedd ezt írta: As for efficiency, that's probably not even worth mentioning in this case. why not? you would use 2 sql queries

Re: [PHP] Random Unique ID

2007-03-21 Thread Stut
[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 go about

Re: [PHP] Random Unique ID

2007-03-21 Thread Rabih Tayyem
function GenerateID () { $len = 3; $base='ABCDEFGHKLMNOPQRSTWXYZ'; $max=strlen($base)-1; $activatecode=''; mt_srand((double)microtime()*100); while (strlen($activatecode)$len+1)$activatecode.=$base{mt_rand(0,$max)}; $len = 7; $base='1234567890'; $max=strlen($base)-1;

Re: [PHP] random selection from each subfolder

2006-12-21 Thread chris smith
On 12/22/06, Steven Macintyre [EMAIL PROTECTED] wrote: Ok ... previous problem sorted ... now onto the next ... The client wants the following; A scroll bar with 3 random thumbs from each subdirectory in the /images/ folder I was thinking ... Going into each folder, getting files, pushing

Re: [PHP] Random pictures - not twice

2006-12-04 Thread tedd
At 11:20 PM +0100 12/3/06, Gustav Wiberg wrote: Hi there! I have created a script the generates random pictures... -snip- With this above script the same picture can be shown twice. Is there any smart way of avoiding this without having to rely on cookies/sessionids? Random does mean it

Re: [PHP] Random pictures - not twice

2006-12-04 Thread Gustav Wiberg
- Original Message - From: tedd [EMAIL PROTECTED] To: Gustav Wiberg [EMAIL PROTECTED]; PHP General php-general@lists.php.net Sent: Monday, December 04, 2006 4:15 PM Subject: Re: [PHP] Random pictures - not twice At 11:20 PM +0100 12/3/06, Gustav Wiberg wrote: Hi there! I have

Re: [PHP] Random pictures - not twice

2006-12-03 Thread tg-php
Without using cookies or session information, you're going to go through your picture list faster depending on how many users are accessing the random pic page. If you don't make it user-specific, then it doesn't really matter if you go through the images sequentially.. it may appear random on

Re: [PHP] Random pictures - not twice

2006-12-03 Thread Gustav Wiberg
- Original Message - From: [EMAIL PROTECTED] To: php-general@lists.php.net Cc: [EMAIL PROTECTED] Sent: Sunday, December 03, 2006 11:52 PM Subject: Re: [PHP] Random pictures - not twice Without using cookies or session information, you're going to go through your picture list faster

Re: [PHP] random string

2006-10-18 Thread eric1235711
You have an array of names and you want to choose a random name. is it? try thinking some thing about arrays, keys numbers, key count, and such Ross wrote: Hi, I want to randomise a string $myrandom = rand(ross, andrea); echo $myrandom; I know this doesn't work but is there

Re: [PHP] random string

2006-10-17 Thread Brice
On 10/17/06, Ross [EMAIL PROTECTED] wrote: Hi, I want to randomise a string $myrandom = rand(ross, andrea); I suggest : $array_name = array(rose,andrea); $myrandom = array_rand($array_name); echo $myrandom[0]; Brice. I know this doesn't work but is there a built in function to do this?

Re: [PHP] random string

2006-10-17 Thread Richard Lynch
On Tue, October 17, 2006 7:30 am, Ross wrote: I want to randomise a string $myrandom = rand(ross, andrea); echo $myrandom; I know this doesn't work but is there a built in function to do this? I'm not real clear on what this is... Choose a string at random from an array? $possibles =

RE: [PHP] Random value from ini file

2006-03-28 Thread Jim Moseby
I have an ini file that has: 1 = words; 2 = words1; 3 = words3; I want to pull a rand value and print it out I'm trying to use parse_ini_file but its not working any help would be great. Thanks You could read them all into an array then use array_rand() to pick one.

Re: [PHP] Random permission strangeness

2006-03-09 Thread Chris
Paul Scott wrote: On Thu, 2006-03-09 at 16:05 +1100, Chris wrote: What's the whole error message (ie context)? Is it coming from cron or randomly in your scripts? From Xdebug... Its random. I am just thinking though that what it *might* be is that the initial session is timing out

Re: [PHP] Random permission strangeness

2006-03-09 Thread Paul Scott
On Fri, 2006-03-10 at 10:26 +1100, Chris wrote: If you leave your browser open for 20 mins or something and then try to log in, does that replicate it? Ah hah! The plot thickens! It seems that I can: 1. Launch the app - thereby starting the initial session 2. Leave the session to time out

Re: [PHP] Random permission strangeness

2006-03-09 Thread Chris
Paul Scott wrote: On Fri, 2006-03-10 at 10:26 +1100, Chris wrote: If you leave your browser open for 20 mins or something and then try to log in, does that replicate it? Ah hah! The plot thickens! It seems that I can: 1. Launch the app - thereby starting the initial session 2. Leave

Re: [PHP] Random permission strangeness

2006-03-09 Thread Paul Scott
On Fri, 2006-03-10 at 16:00 +1100, Chris wrote: If you can produce a small test case might be time for a bug report. It shouldn't give you permission denied errors. Will work on it over the weekend. I am going to try something dead simple with the session stuff and see what I can do with it.

Re: [PHP] Random permission strangeness

2006-03-08 Thread Chris
Paul Scott wrote: I am pretty much randomly getting the following error: .. ps_files_cleanup_dir: opendir(/var/lib/php5) failed: Permission denied (13) in ... As far as I can see the session write directory has no problems with permissions. The *really* strange thing is that it only fails

Re: [PHP] Random permission strangeness

2006-03-08 Thread Paul Scott
On Thu, 2006-03-09 at 16:05 +1100, Chris wrote: What's the whole error message (ie context)? Is it coming from cron or randomly in your scripts? From Xdebug... Its random. I am just thinking though that what it *might* be is that the initial session is timing out between the app launch and

Re: [PHP] Random Images with no duplicates?

2005-12-20 Thread Mike
Mike [EMAIL PROTECTED] wrote in message news:... I'd just like to thank everyone who helped me our with this. I think it's great that so many people would be so helpful and not expect anything in return. This list is quite a storehouse of info and I'm learning just from reading the posts

Re: [PHP] Random Images with no duplicates?

2005-12-19 Thread Mike
I'd just like to thank everyone who helped me our with this. I think it's great that so many people would be so helpful and not expect anything in return. This list is quite a storehouse of info and I'm learning just from reading the posts since I joined last week! Again, thanks all. -Mike

Re: [PHP] Random Images with no duplicates?

2005-12-18 Thread Silvio Porcellana [tradeOver]
Jared Williams wrote: Hi, Just unset the ones you've picked ?php #random images example #this is your file $file = images.txt; #open the file $openFile = file($file); #generate a random number srand((double)microtime()*100); #get one of the entries in the file for ($i = 0;

Re: [PHP] Random Images with no duplicates?

2005-12-18 Thread Silvio Porcellana [tradeOver]
Silvio Porcellana [tradeOver] wrote: code $file = images.txt; $openFile = file($file); $num_images = 10; # don't need this is PHP 4.2.0 srand((float) microtime() * 1000); $random_keys = array_rand($openFile, $num_images); foreach

RE: [PHP] Random Images with no duplicates?

2005-12-16 Thread Kilbride, James
choices. -Original Message- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: Friday, December 16, 2005 2:47 AM To: php-general@lists.php.net Subject: Re: [PHP] Random Images with no duplicates? On Thu, Dec 15, 2005 at 08:45:33PM -0800, Mike Rondeau wrote: Hi, I'm still very

RE: [PHP] Random Images with no duplicates?

2005-12-16 Thread Jared Williams
Hi, Just unset the ones you've picked ?php #random images example #this is your file $file = images.txt; #open the file $openFile = file($file); #generate a random number srand((double)microtime()*100); #get one of the entries in the file for ($i = 0; $i 10; ++$i) { $r =

Re: [PHP] Random Images with no duplicates?

2005-12-15 Thread Aaron Koning
This should work, although if there are only 9 lines in the file, it will run infintely (or until the page times out)... so put a check in for that. $imagesNeeded = 10; $imageArr = array(); // Create array with $imagesNeeded number of elements. for($i=0;$i$imagesNeeded;$i++) { // choose image

Re: [PHP] Random Images with no duplicates?

2005-12-15 Thread Curt Zirzow
On Thu, Dec 15, 2005 at 08:45:33PM -0800, Mike Rondeau wrote: Hi, I'm still very green with PHP, but am working to fix that. I've searched high and low for an answer to this question and so far no solution has presented itself. I have a script to populate my web page with random images:

Re: [PHP] random row

2005-11-15 Thread Jasper Bryant-Greene
John Taylor-Johnston wrote: My question is simnple. I want to randomly select a row in a mysql table. I have a primary id. ?php $server = localhost; $user = foo; $pass = foo; $db=foo_db; $table=foo_table; $myconnection = mysql_connect($server,$user,$pass); mysql_select_db($db,$myconnection);

Re: [PHP] random row

2005-11-15 Thread Curt Zirzow
On Wed, Nov 16, 2005 at 05:19:52PM +1300, Jasper Bryant-Greene wrote: John Taylor-Johnston wrote: My question is simnple. I want to randomly select a row in a mysql table. I have a primary id. ?php $server = localhost; $user = foo; $pass = foo; $db=foo_db; $table=foo_table;

Re: [PHP] Random but ordered..

2005-05-08 Thread Richard Lynch
Check the MySQL manual for how to order randomly. They might have a way to do it. However... If there are a fairly number of consistent plans in each company, you might be better off with something that just chooses N companies at random, enough to fill a page, and that's it. One wrinkle is

Re: [PHP] Random but ordered..

2005-05-07 Thread Marek Kilimajer
Ryan A wrote: Hey, I have been screwing around with this code for around a day and am hitting a wall, any help would be appreciated. Basically, I am working on a site that queries the DB for companies and the plans the company is offering, the DB is quite big (a few thousand records in each of the

Re: [PHP] Random data loss.

2004-12-07 Thread Richard Lynch
2wsxdr5 wrote: With out posting any code I was wondering if anyone here has been experiencing this kind of problem. I have a standard web from that PHP code then reads and saves the data into a MySQL DB. The problem is some of my users have had data lost somewhere in this process. The web

Re: [PHP] Random data loss.

2004-12-07 Thread 2wsxdr5
I think I need to give more details. The data loss happens somewhere between the form post button press and the data being inserted into the DB. It is a simple sql insert statement on a table with auto increment keys. The price should be entered as a floating point number and that is what

RE: [PHP] Random data loss.

2004-12-06 Thread Vail, Warren
Could be a problem of multiple update modules for the same table. When I've encountered this problem in the past it's been one of two causes. 1. In the process of maintaining the table one routine that has no price information, retrieves the row and notices that the something needs to be

Re: [PHP] Random data loss.

2004-12-06 Thread Raditha Dissanayake
2wsxdr5 wrote: With out posting any code I was wondering if anyone here has been experiencing this kind of problem. I have a standard web from that PHP code then reads and saves the data into a MySQL DB. The problem is some of my users have had data lost somewhere in this process. The web

  1   2   3   >