RE: Logic Help...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Scott,

What is the variable $cntr set to on your first iteration through the loop?
I'm assuming that, in the real world, it can be set to about anything, but
what value is it set with now while you're testing? I'd suggest adding echo
$cntr; before your while statement so you can see what it's set to right
before this block is supposed to execute.

If it's set to 0, then, no, your code block won't be executed.

If it's set to something else, it might be playing havoc with your second if
statement and the contents of the specified $shell and $grp arrays. For
example, if $cntr is set to, say, 50, you decrement it ($cntr--) then test
the two arrays in the next if statement $shell[49] and $grp[49]. If those
array positions don't work for the data that's stored in them, that might be
trouble spot as well.

Just thinking off the cuff here. 

> -----Original Message-----
> From: NIPP, SCOTT V (SBCSI) [mailto:sn4265@sbc.com]
> Sent: Wednesday, August 27, 2003 10:04 AM
> To: CPT John W. Holmes; php-db@lists.php.net
> Subject: RE:  Logic Help...
> 
> 
> 	Thanks for the feedback.  This seems to have helped, 
> but something
> is still not working with the logic.  Here is the updated code:
> 
> <?php
>   while($cntr != 0) {
>     $cntr--;
>     if (($shell[$cntr] == "") || ($grp[$cntr] == "")) {
> 	  echo "<p align=\"center\"><font color=\"#99CCCC\"
> size=\"4\">Sorry, but your request was not filled out 
> completely.  Please
> resubmit this request ensuring that you have selected a 
> Primary Group and
> Default Shell.</font></p>";
>       echo "<p align=\"center\"><font color=\"#99CCCC\" 
> size=\"4\">Please
> follow this <a
> href=\"http://ldsa.sbcld.sbc.com/DW/NewUser/newuser.php\";>link
> </a> to return
> to the beginning of the request process.</font></p>";
> 	  exit;
> 	}
>   }
> ?>
> 
> 	Now, the test conditions never seem to enter into this 
> portion of
> code.  I am unable to figure out why at this point.  Thanks 
> again for the
> help.
> 
> -----Original Message-----
> From: CPT John W. Holmes [mailto:holmes072000@charter.net]
> Sent: Tuesday, August 26, 2003 9:15 AM
> To: NIPP, SCOTT V (SBCSI); php-db@lists.php.net
> Subject: Re:  Logic Help...
> 
> 
> From: "NIPP, SCOTT V (SBCSI)" <sn4265@sbc.com>
> 
> 
> > This isn't specifically a DB related question, but...  The following
> > code snippet is not functioning for me.  I keep receiving a 
> parse error on
> > the "if" line.  Basically I want to stop execution of this 
> page if either
> of
> > the conditions in the "if" statement exist.  Thanks in advance.
> >
> >
> > #  while($cntr != 0) {
> > #    if (($shell[$cntr] eq "") || ($grp[$cntr] eq "Primary Gr")) {
> 
> Umm... you don't use 'eq' in PHP, you use == (that's two equal signs).
> 
> ---John Holmes...
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux