i want to echo something like the following in a file(eg: test.php).
…
201105
201106
201107
201108
201109
201110
…
the code output it may be:
$months = 10; //count of months
$date = date_create( 'now' );
echo date_format( $date, 'Y M' );
for ( $i = 0; $i < $months; $i++ ) {
date_sub( $date , date_interval_create_from_date_string( '1 months' ) );
echo date_format( $date, 'Y M' );
}
i fell the code isn’t very good. the above is the year-month archive. now i want to when the user click the year-month. then in the current page shows each articles’ title with list that belong to the year-month. i know i should use a passed value into my database query then select out each articles’ title.supposed each article created time is stored as this 15806927473. but i don’t know how to passed the value. when the user click the year-month. and use the passed value in my sql query. thank you.