/ Published in: PHP
This has been updated, fully working now
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public function create_archive() { // Loop through the database grabbing all the dates:: // $sql = "SELECT DISTINCT blog_date FROM subarc_blog ORDER BY blog_date"; $sql = "SELECT DISTINCT MONTHNAME(blog_date) as blog_month, YEAR(blog_date) as blog_year FROM subarc_blog ORDER BY blog_date"; $stmt = $this->conn->prepare($sql); $stmt->execute(); $stmt->bind_result($month,$year); while($row = $stmt->fetch()) { 'blog_month' => $month, 'blog_year' => $year ); $rows[] = $item; } $stmt->close(); return $rows; }