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" Link to comment https://forums.phpfreaks.com/topic/267488-mistakes-in-short-code/ 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. Link to comment https://forums.phpfreaks.com/topic/267488-mistakes-in-short-code/#findComment-1371832 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. Link to comment https://forums.phpfreaks.com/topic/267488-mistakes-in-short-code/#findComment-1371834 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"; Link to comment https://forums.phpfreaks.com/topic/267488-mistakes-in-short-code/#findComment-1371838 Share on other sites More sharing options...
Jessica Posted August 23, 2012 Share Posted August 23, 2012 That is still way messed up. Link to comment https://forums.phpfreaks.com/topic/267488-mistakes-in-short-code/#findComment-1371839 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.