Hi guys, I have a sql problem and i don't know how to fix it, I have tried a few things but..you know.So here is my query:
/**
* Returns a list with all the months for the archive
*
* @return array
*/
public function Archive()
{
$q = "SELECT DISTINCT MONTH(`data`) AS `month`,YEAR(`data`) AS `year` FROM `posts` ORDER BY `data` DESC";
$all = $this->fetchAll($q);
if (count($all) > 0) {
foreach ($all as $info) {
$months[] = array('month_name'=>$this->months($info['month']),'year'=>$info['year'],'month'=>$info['month']);
}
return $months;
}else{
return false;
}
}
And my Error:
Fatal error: Uncaught exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s)' in
Any help?