I really haven't done anything with that blog code you're referring to, but I know Jacek made a Database Searching tutorial using that blog as a base.
http://betterphp.co.uk/playlist.html?pi ... 759BABE5EC
I haven't watched it in ages so I can't remember if it does exactly what you want, but it should get you on the way. I'll be available to help if you have any questions.
Blog Archive by Month, Year
Re: Blog Archive by Month, Year
There are a few things I would do differently, and some I wouldn't do at all.
First of all, I would just fetch the post_date as is. It is a unix timestamp if I'm not mistaken, and those are really easy to manipulate with PHP instead of SQL.
Check out the date() function.
My head isn't on straight today. I've been without sleep for 48+ hours so I might not be thinking right.
Let me know if it's not working and I'll come back when I've slept some.
First of all, I would just fetch the post_date as is. It is a unix timestamp if I'm not mistaken, and those are really easy to manipulate with PHP instead of SQL.
function get_archive(){ $sql = "SELECT `post_date` AS `date` COUNT(*) AS `total` FROM `posts` $result = mysqli_query($sql); $rows = array(); while (($row = mysqli_fetch_assoc($result)) != false){ $rows[] = array( 'date' => $row['date'], 'count' => $row['total'] ); } return $rows; }I would then use php functions to make the timestamp readable in the way you want.
Check out the date() function.
My head isn't on straight today. I've been without sleep for 48+ hours so I might not be thinking right.
Let me know if it's not working and I'll come back when I've slept some.