Could it be the semi colon at the end of the 'if' line, at '... $nChar =
45); { ...'  ?  Looks like the if statement ends there, the ' { print
"OK."; } ' is a block on it's own and the 'else' is now out of context.

-----Original Message-----
From: Brad Melendy [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 19, 2001 8:03 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Can I have If...Else inside a For Loop???


Hi All,
I'm stumped.  I've got the following code:

<?php
if(isSet($domain))
{
 for ( $counter=0; $counter <= strlen($domain); $counter++ )
  {
  $nChar = ord(strtolower(substr($domain, $counter, 1)));
  if (($nChar > 47 And $nChar < 58) or ($nChar > 96 And $nChar < 123) or
$nChar = 45);
   {
   print "OK.";
   }
  else
   {
   print "Not OK.";
   }
  }
}
?>

What's got me beat is that this code fails on the ELSE statement.  Now, if I
comment out the ELSE statement, the code proceeds, I just don't get the
results I want when the coditions in IF statement are false.

Anyone know what I'm doing wrong?  It's as if you can't nest an IF/Else
under a FOR, but you can use just an IF.  Thanks very much in advance.

....Brad




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to