gpt4 book ai didi

php - Zend 框架基数违规 : 1241 Operand should contain 1 column(s)

转载 作者:可可西里 更新时间:2023-11-01 07:03:07 26 4
gpt4 key购买 nike

我有一个 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;
}
}

还有我的错误:

Fatal error: Uncaught exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s)' in

有什么帮助吗?

最佳答案

我遇到了同样的问题,最后我发现我为一列发布了错误的值。我为一列发送了 2 个值。因此,请检查提供给函数的参数值。

关于php - Zend 框架基数违规 : 1241 Operand should contain 1 column(s),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1537128/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com