Zend Framework基数违规:1241操作数应包含1列

Uff*_*ffo 5 php mysql zend-framework

我有一个SQL问题,我不知道如何解决它,我已经尝试了一些东西但是..你知道.所以这是我的查询:

    /**
 * 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;
 }
}
Run Code Online (Sandbox Code Playgroud)

而我的错误:

致命错误:未捕获的异常'Zend_Db_Statement_Exception',消息'SQLSTATE [21000]:基数违规:1241操作数应包含1列'

有帮助吗?

And*_*rew 3

您是否错过了流程中的某个阶段?查询语句行如下:

    /**
 * 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";
 $stmt = $db->query($q);
 $all = $stmt->fetchAll(); 
 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;
 }
}
Run Code Online (Sandbox Code Playgroud)