I have a script with the following code because I couldn't get a while loop to work...
Code:
$timespan = 'thread.dateline<UNIX_TIMESTAMP(CURDATE()) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-1)';
construct_newsdays();
$timespan = 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-1) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-2)';
construct_newsdays();
$timespan = 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-2) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-3)';
construct_newsdays();
$timespan = 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-3) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-4)';
construct_newsdays();
$timespan = 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-4) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-5)';
construct_newsdays();
$timespan = 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-5) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-6)';
construct_newsdays();
$timespan = 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-6) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-7)';
construct_newsdays();
$timespan = 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-7) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-8)';
construct_newsdays();
Now, the code I'd like to use but can't get to work
Code:
$counter = "0";
while ($counter<=7)
{ $timespan = 'thread.dateline<UNIX_TIMESTAMP(CURDATE()' . $counter . ') AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-' . $counter-1 . ')';
construct_newsdays();
}
Any ideas (yes, I do feel like a complete n00ber for not being able to get a loop to work).