Captain09 Posted August 23, 2012 Share Posted August 23, 2012 hey folks, whats wrong with my code? if ((time()-COMMENCE)/86400 < 1); $start = "today"; elseif (round((time()-COMMENCE)/86400)) == 1; $start = "yesterday"; else $start = "before <?php echo round((time()-COMMENCE)/86400);?> days" Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 23, 2012 Share Posted August 23, 2012 http://us.php.net/manual/en/control-structures.alternative-syntax.php http://us.php.net/manual/en/control-structures.if.php You're missing some punctuation. On most lines. Quote Link to comment Share on other sites More sharing options...
Adam Posted August 23, 2012 Share Posted August 23, 2012 You're missing brackets around your else-if expression and you have a semi-colon after the if expression. In future please provide context to your question; what's not working, what error messages are you getting, etc. Quote Link to comment Share on other sites More sharing options...
Captain09 Posted August 23, 2012 Author Share Posted August 23, 2012 thanks I got it: if (((time()-COMMENCE)/86400 < 1)) $start = "today"; elseif ((round((time()-COMMENCE)/86400)) == 1) $start = "yesterday"; elseif ((round((time()-COMMENCE)/86400)) == 2) $start = "the day before yesterday"; else $start = "before" <?php echo round((time()-COMMENCE)/86400);?> days"; Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 23, 2012 Share Posted August 23, 2012 That is still way messed up. 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.