Revision: 35133
Updated Code
at November 4, 2010 01:52 by JonnySnip3r
Updated Code
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);
$rows = array();
while($row = $stmt->fetch())
{
$item = array(
'blog_month' => $month,
'blog_year' => $year
);
$rows[] = $item;
}
$stmt->close();
return $rows;
}
Revision: 35132
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 3, 2010 04:00 by JonnySnip3r
Initial Code
public function create_archive()
{
// Loop through the database grabbing all the dates::
$sql = "SELECT blog_date FROM subarc_blog";
$stmt = $this->conn->prepare($sql);
$stmt->execute();
$stmt->bind_result($date);
$rows = array();
while($row = $stmt->fetch())
{
$date = explode("-",$date);
$month = date("F",mktime(0,0,0,$date['1']));
$year = $date[0];
$item = array(
'blog_month' => $month,
'blog_year' => $year
);
$rows[] = $item;
}
$stmt->close();
return $rows;
}
Initial URL
Initial Description
This has been updated, fully working now
Initial Title
Create Archive Function
Initial Tags
Initial Language
PHP