CDbException

CDbCommand 无法执行 SQL 语句: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') LIMIT 10' at line 1. The SQL statement executed was: SELECT id,title,description FROM `pre_articles` `t` WHERE typeid = 878 AND status = 1 AND areaId IN () LIMIT 10

/home/wwwroot/framework/db/CDbCommand.php(543)

531         {
532             if($this->_connection->enableProfiling)
533                 Yii::endProfile('system.db.CDbCommand.query('.$this->getText().$par.')','system.db.CDbCommand.query');
534 
535             $errorInfo=$e instanceof PDOException ? $e->errorInfo : null;
536             $message=$e->getMessage();
537             Yii::log(Yii::t('yii','CDbCommand::{method}() failed: {error}. The SQL statement executed was: {sql}.',
538                 array('{method}'=>$method, '{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
539 
540             if(YII_DEBUG)
541                 $message.='. The SQL statement executed was: '.$this->getText().$par;
542 
543             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
544                 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
545         }
546     }
547 
548     /**
549      * Builds a SQL SELECT statement from the given query specification.
550      * @param array $query the query specification in name-value pairs. The following
551      * query options are supported: {@link select}, {@link distinct}, {@link from},
552      * {@link where}, {@link join}, {@link group}, {@link having}, {@link order},
553      * {@link limit}, {@link offset} and {@link union}.
554      * @throws CDbException if "from" key is not present in given query parameter
555      * @return string the SQL statement

Stack Trace

#3
+
 /home/wwwroot/tell1/protected/models/Articles.php(422): CActiveRecord->findAll(array("condition" => "typeid = 878 AND status = 1 AND areaId IN ()", "select" => "id,title,description", "limit" => 10))
417         $allid = implode(',',$allid);
418         $articleall = self::model()->findAll([
419             "condition" => "typeid = 878 AND status = 1 AND areaId IN ({$allid})",
420             "select" => "id,title,description",
421             "limit" => $limit
422         ]);
423         if(sizeof($articleall)<$limit){
424             $arr = [41522,41563,41541,41502,41556,41498,41494,41545,42094,41616];
425             foreach($articleall as $k=>$v){
426                 if(in_array($v['id'],$arr)){
427                     unset($articleall[$k]);
#4
+
 /home/wwwroot/tell1/protected/controllers/IndexController.php(275): Articles::hotaddress("103581")
270 
271         //选择到有景点的地区显示数据
272         $index_are = Position::findArea($areaInfo);
273 
274         //地区热门求婚地点
275         $hotaddress = Articles::hotaddress($this->areaInfo['id']);
276 
277         // 区县
278         $quxian = Area::footerAreasquxin($this->areaInfo);
279         $data = array(
280             'orderNews'      => $orderNews,
#5
+
 /home/wwwroot/tell1/protected/controllers/IndexController.php(20): IndexController->areaIndex(Area)
15             $this->index();
16             Yii::app()->end();
17         }
18         $areaInfo = Area::findByName($areaName);
19         if($areaInfo){
20             $this->areaIndex($areaInfo);
21             Yii::app()->end();
22         }
23         $tagInfo= Tags::findByName($areaName);
24         if($tagInfo){
25             $this->nav1 = true;
2020-01-23 06:44:07 nginx/1.10.0 Yii Framework/1.1.17
Baidu
sogou