On Friday 24 January 2003 00:24, Christopher Ditty wrote:
> Hello all.  I have a few servers that I need to check during a login
> process.  If the first server fails to connect, then I need to do server #2
> and so on.  Below is the code that I am using, but I am unable to get it to
> work like it should.  Can anyone offer some advice on how this should be
> accomplushed?
>
> Thanks
>
> CDitty
>
>
> function sConnect($serverID){
>       $ds = ldap_connect($serverID);
>       return $ds;
> }

Is that above function relevant? You've defined it but it's not being used in 
the code below?

> $i = 0;
> do{
>       ldapConnect($config['ldapServer'][$i]);
>       $i++;
> }while(!$ds && ($i < (count($config['ldapServer']) + 1)));

Anyway you can try something like:

  foreach ($config['ldapServer'] as $key => $value) {
    if (ldapConnect($value)) { // if successfully connected
      $server = $value;
      break;
    }
  }
  echo "Connected to server $server";

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
I have that old biological urge,
I have that old irresistible surge,
I'm hungry.
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to