Re: [nyphp-talk] Help with while loop

2006-11-27 Thread Ken Robinson
At 03:43 PM 11/27/2006, Randal Rust wrote: Yeah, I know. This is the client's hair-brained idea. I told him I'd take a look. The problem all goes back to how they are handling their data. They are using LDAP for data storage. Each record has a 'key' value which they want to be unique. The key i

Re: [nyphp-talk] Help with while loop

2006-11-27 Thread Chris Shiflett
Randal Rust wrote: > If $unique returns false, I need to run some other scripts that will > *attempt* to uniquely generate a new value, then take the new value > and run checkDuplicate() again. And so on until $unique returns true. while (!$unique) { /* Change $newTeam */ $unique = checkDu

Re: [nyphp-talk] Help with while loop

2006-11-27 Thread Randal Rust
On 11/27/06, Chris Shiflett <[EMAIL PROTECTED]> wrote: As a helpful suggestion, when it takes 40 lines of code to check to see whether a value is in an array, it's probably a good idea to take a step back and see if there is a simpler solution: Yeah, I know. This is the client's hair-brained i

Re: [nyphp-talk] Help with while loop

2006-11-27 Thread Randal Rust
On 11/27/06, Ken Robinson <[EMAIL PROTECTED]> wrote: $unique = checkDuplicate($newTeam); Again, my fault for not being clear enough. If $unique returns false, I need to run some other scripts that will *attempt* to uniquely generate a new value, then take the new value and run checkDuplicate(

Re: [nyphp-talk] Help with while loop

2006-11-27 Thread Chris Shiflett
Randal Rust wrote: > while(!$unique) { > $check=checkDuplicate($newTeam); > > if($check) { > $unique=true; > } else { > $unique=false; } > } Guess what happens when $unique is FALSE? As a helpful suggestion, when it takes 40 lines of code to check to see whether a

Re: [nyphp-talk] Help with while loop

2006-11-27 Thread Randal Rust
On 11/27/06, Rob Marscher <[EMAIL PROTECTED]> wrote: The way it looks now... your doing a while loop that will keep looping until unique is true. If unique never gets set to true, then it's going to loop forever. I don't see a need for that while loop. I didn't properly explain before. I do

Re: [nyphp-talk] Help with while loop

2006-11-27 Thread Randal Rust
On 11/27/06, Scott Mattocks <[EMAIL PROTECTED]> wrote: I am confused as to why you are looping over one value to begin with? Oh yeah, that would probably have been helpful. OK, the deal is that I need to ensure that the value that gets inserted into the LDAP directory is unique. So if the val

Re: [nyphp-talk] Help with while loop

2006-11-27 Thread Rob Marscher
The way it looks now... your doing a while loop that will keep looping until unique is true. If unique never gets set to true, then it's going to loop forever. I don't see a need for that while loop. You can just do $unique=checkDuplicate($newTeam); also... your function could be simplified

Re: [nyphp-talk] Help with while loop

2006-11-27 Thread Scott Mattocks
Randal Rust wrote: I have always had trouble with trying to write these from scratch. The code below is essentially what I have been working on, but it never stops looping. What am I missing here? I am confused as to why you are looping over one value to begin with? You really only need to loo

Re: [nyphp-talk] Help with while loop

2006-11-27 Thread Ken Robinson
At 03:10 PM 11/27/2006, Randal Rust wrote: I have always had trouble with trying to write these from scratch. The code below is essentially what I have been working on, but it never stops looping. What am I missing here? You don't need a loop here. The loop is in the function, where it belong

[nyphp-talk] Help with while loop

2006-11-27 Thread Randal Rust
I have always had trouble with trying to write these from scratch. The code below is essentially what I have been working on, but it never stops looping. What am I missing here? -- Randal Rust R.Squared Communications www.r2communications.com ___ New