RE: [PHP-DB] Logic Help...
Thanks for all the help. I was finally able to get this working properly by viewing the variable data as suggested. I then ran into another minor issue with session variables keeping their old values on a second pass through the application, but I resolved this by unregistering these variables before sending the user back through the application. One strange thing I noticed was that you can register multiple variables with a single session_register, but you have to unregister only a single variable at a time. Anyone know anything more about this? Am I doing something wrong, or is it this way by design? Thanks. -Original Message- From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 27, 2003 4:10 PM To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Subject: Re: [PHP-DB] Logic Help... From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> > Thanks for the feedback. This seems to have helped, but something > is still not working with the logic. Here is the updated code: > >while($cntr != 0) { > $cntr--; > if (($shell[$cntr] == "") || ($grp[$cntr] == "")) { > echo " 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."; > echo "Please > follow this href=\"http://ldsa.sbcld.sbc.com/DW/NewUser/newuser.php\";>link to return > to the beginning of the request process."; > 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. Okay... let's do some basic debugging now. What does print_r($shell) and print_r($grp) display? Are there any entries that are equal to an empty string? ---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
Re: [PHP-DB] Logic Help...
From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> > Thanks for the feedback. This seems to have helped, but something > is still not working with the logic. Here is the updated code: > >while($cntr != 0) { > $cntr--; > if (($shell[$cntr] == "") || ($grp[$cntr] == "")) { > echo " 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."; > echo "Please > follow this href=\"http://ldsa.sbcld.sbc.com/DW/NewUser/newuser.php\";>link to return > to the beginning of the request process."; > 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. Okay... let's do some basic debugging now. What does print_r($shell) and print_r($grp) display? Are there any entries that are equal to an empty string? ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Logic Help...
if its never entering hte test process maybe you're not holding what you think you are in the arrays. each time through the loop, before the if statemetn, just add a print_r($shell[$cntr]) and/or print_r($grp[$cntr] == ""). for that matter you could print_r both arrays so you can see exactly what they contain. they must be getting set to something if that logic does not work. Do you possibly have default values in the HTML? are these checkboxes, which don't get added to the POST/GET arrays if they are not checked? hth jeff "NIPP, SCOTT V (SBCSI)" To: "CPT John W. Holmes" <[EMAIL PROTECTED]>, [EMAIL PROTECTED] <[EMAIL PROTECTED]> cc: Subject: RE: [PHP-DB] Logic Help... 08/27/2003 10:04 AM Thanks for the feedback. This seems to have helped, but something is still not working with the logic. Here is the updated code: Sorry, but your request was not filled out completely. Please resubmit this request ensuring that you have selected a Primary Group and Default Shell."; echo "Please follow this http://ldsa.sbcld.sbc.com/DW/NewUser/newuser.php\";>link to return to the beginning of the request process."; 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:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2003 9:15 AM To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Subject: Re: [PHP-DB] Logic Help... From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> > 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
RE: [PHP-DB] Logic Help...
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:[EMAIL PROTECTED] > Sent: Wednesday, August 27, 2003 10:04 AM > To: CPT John W. Holmes; [EMAIL PROTECTED] > Subject: RE: [PHP-DB] 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: > >while($cntr != 0) { > $cntr--; > if (($shell[$cntr] == "") || ($grp[$cntr] == "")) { > echo " 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."; > echo " size=\"4\">Please > follow this href=\"http://ldsa.sbcld.sbc.com/DW/NewUser/newuser.php\";>link > to return > to the beginning of the request process."; > 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:[EMAIL PROTECTED] > Sent: Tuesday, August 26, 2003 9:15 AM > To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] > Subject: Re: [PHP-DB] Logic Help... > > > From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> > > > > 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
RE: [PHP-DB] 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: Sorry, but your request was not filled out completely. Please resubmit this request ensuring that you have selected a Primary Group and Default Shell."; echo "Please follow this http://ldsa.sbcld.sbc.com/DW/NewUser/newuser.php\";>link to return to the beginning of the request process."; 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:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2003 9:15 AM To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Subject: Re: [PHP-DB] Logic Help... From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> > 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
Re: [PHP-DB] Logic Help...
From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> > 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