dbutler Posted August 16, 2008 Share Posted August 16, 2008 I can't seem to get the below syntax to work correctly: if (($_SESSSION['rights'] != "super") AND ($sess_level < $status_level OR $row2['app_status'] == 1)) { $err_msg = "This project has been approved and can only be edited by a user at the current STATUS level."; } when the $_SESSION['rights'] variable does NOT equal "super", the rest works perfectly. However, when the session rights DO equal "super" then either of the other two conditions still causes the IF to be true. I think the logic of the statement looks correct, but is there a syntax issue? Essentially I want the statement to return FALSE if the session rights do equal super. Thanks in advance...drb Link to comment Share on other sites More sharing options...
Ingolme Posted August 16, 2008 Share Posted August 16, 2008 The logic looks correct. And if the syntak was wrong the program would throw an error.Personally I prefer "&&" and "||" before "AND" and "OR", but I don't think that's what's making your program work wrong. Link to comment Share on other sites More sharing options...
jeffman Posted August 16, 2008 Share Posted August 16, 2008 EDIT: I take it back. Link to comment Share on other sites More sharing options...
dbutler Posted August 16, 2008 Author Share Posted August 16, 2008 I tried using $$ and ||, I also tried AND and ||, and I tried && and OR, but none of them worked. Still scratching... Link to comment Share on other sites More sharing options...
jeffman Posted August 16, 2008 Share Posted August 16, 2008 How do you know it's not working? Have you put an echo statement in the curly braces? And how do you know the session rights really = "super"? No chance there's a stray newline or other character in there? Have you echoed that variable? Checked its length (to rule out invisible characters)?As Ingolme said, the logic really does look correct. Link to comment Share on other sites More sharing options...
dbutler Posted August 16, 2008 Author Share Posted August 16, 2008 yes sir, I echo the session rights on the page and the other variables are echoed within the page as well. Although, I do echo characters in place of the numeric numbers in these variables (ie. if level = 10 I echo a word instead). I will echo out the exact values to be sure. Standby... Link to comment Share on other sites More sharing options...
dbutler Posted August 16, 2008 Author Share Posted August 16, 2008 Hmmm...there is a problem. I echo the session rights in the header (in an include statement from the main PHP) but then when I try to echo it again it shows up blank, which would describe the issue above. However, now I can't seem to find why the session rights went away...one problem leads to another ;-) Link to comment Share on other sites More sharing options...
dbutler Posted August 16, 2008 Author Share Posted August 16, 2008 nevermind, typo, trying again... Link to comment Share on other sites More sharing options...
Ingolme Posted August 16, 2008 Share Posted August 16, 2008 Maybe we could spot the error if you post all the code. Link to comment Share on other sites More sharing options...
dbutler Posted August 16, 2008 Author Share Posted August 16, 2008 So I fixed the echo typo and then re-typed the exact same statement and now it works...I have no idea what was wrong, but maybe there was a space or something in there like you said. I think I've just been working on this too long today. Thanks for your help...drb Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.