dekonstruct Posted December 17, 2006 Share Posted December 17, 2006 I'm having problems setting $_SESSION['dailies'] back to the date when it gets to 0.Here's my code: [code]<?phpsession_start();$date = date('z');###counter###if(isset($_SESSION['counted'])){$new = $_SESSION['counted'] - 5;$_SESSION['counted'] = $new;}else {$_SESSION['counted'] = 0;}############ supposed to set counter back to date ###if ($_SESSION['dailies'] <= 0) { $_SESSION['dailies'] = date('z');}else { $_SESSION['dailies'] = $date + $_SESSION['counted']; echo $_SESSION['dailies'];}?>[/code]I think it might have something to do with the placement of my if statement in the code but I've tried it both before and after the counter function. BAH!Any help and I'll love you forever. (in a non brokeback kind of way). Quote Link to comment Share on other sites More sharing options...
trq Posted December 17, 2006 Share Posted December 17, 2006 [quote]I've tried it both before and after the counter function.[/quote]You don't have a counter function, so Im not sure what your talking about there.Could you show us where you first define $_SESSION['dailies']? Quote Link to comment Share on other sites More sharing options...
dekonstruct Posted December 17, 2006 Author Share Posted December 17, 2006 I first define $_SESSION['dailies']; in the else part with:[code]$_SESSION['dailies'] = $date + $_SESSION['counted'];[/code]It's so that when the page first loads it's at 0 and when it refreshes it counts down from the day. If there's a better way to do it I'm all ears, it feels like an ineloquent solution but I'm still learning obviously.Thanks! 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.