Hyaku_ Posted January 9, 2007 Share Posted January 9, 2007 [code]if(((time() - $user->last_activity)/60) > 20){ break; }..long peace of code..[/code]It works exactly like I want, except I'm getting:[code]Cannot break/continue 1 level[/code]is there something else as break or any other suggestions? Thanks! Quote Link to comment Share on other sites More sharing options...
marcus Posted January 9, 2007 Share Posted January 9, 2007 [code=php:0]if( ({time() - $user->last_activity)/60) > 20){break;}[/code] Quote Link to comment Share on other sites More sharing options...
Hyaku_ Posted January 10, 2007 Author Share Posted January 10, 2007 parse error, unexpected '{'. Is that character sopose to do something or what? Quote Link to comment Share on other sites More sharing options...
emehrkay Posted January 10, 2007 Share Posted January 10, 2007 is this if statement inside of a loop? Quote Link to comment Share on other sites More sharing options...
Hyaku_ Posted January 10, 2007 Author Share Posted January 10, 2007 no, it just a regular if statement. I'm just trying to prevent Cannot break/continue 1 level error. Quote Link to comment Share on other sites More sharing options...
emehrkay Posted January 10, 2007 Share Posted January 10, 2007 expalin what you are trying to do. i dont understand why you'd want to break at that point or what you expect the code to do if your statement is true Quote Link to comment Share on other sites More sharing options...
Asheeown Posted January 10, 2007 Share Posted January 10, 2007 if( ({time() ^ Hmm have a look at that one...also their are three "(" but you only close two of them Quote Link to comment Share on other sites More sharing options...
Hyaku_ Posted January 10, 2007 Author Share Posted January 10, 2007 [quote author=emehrkay link=topic=121699.msg501589#msg501589 date=1168458367]expalin what you are trying to do. i dont understand why you'd want to break at that point or what you expect the code to do if your statement is true[/quote]This is what I'm trying to do:header.php[code]if($timeout == TRUE){ // if account expires display this message and stop executing the rest of the code echo $timout_msg; break; }..[/code]header.php will be included in every page, if user account timeouts, the statement will be executed and I don't want the rest of the code to be executed, thats why I use break, but I get that error. So when the account is timeouted, this is what I get:[quote]Your account has been inactive for 29 minutes.Please login againFatal error: Cannot break/continue 1 level in /var/www/htdocs/include/header.php on line 19[/quote] Quote Link to comment Share on other sites More sharing options...
emehrkay Posted January 10, 2007 Share Posted January 10, 2007 try exit; or end; Quote Link to comment Share on other sites More sharing options...
Hyaku_ Posted January 10, 2007 Author Share Posted January 10, 2007 Thanks, that worked! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.