CDbException

CDbCommand 无法执行 SQL 语句: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in where clause is ambiguous. The SQL statement executed was: SELECT `t`.`id` AS `t0_c0`, `t`.`userid` AS `t0_c1`, `t`.`areaid` AS `t0_c2`, `t`.`title` AS `t0_c3`, `t`.`read_num` AS `t0_c4`, `t`.`comment_num` AS `t0_c5`, `t`.`video_url` AS `t0_c6`, `t`.`cover_imgs` AS `t0_c7`, `t`.`videoid` AS `t0_c10`, `videoInfo`.`id` AS `t1_c0`, `videoInfo`.`uid` AS `t1_c1`, `videoInfo`.`logid` AS `t1_c2`, `videoInfo`.`classify` AS `t1_c3`, `videoInfo`.`title` AS `t1_c4`, `videoInfo`.`content` AS `t1_c5`, `videoInfo`.`url` AS `t1_c6`, `videoInfo`.`swfurl` AS `t1_c7`, `videoInfo`.`h5url` AS `t1_c8`, `videoInfo`.`company` AS `t1_c9`, `videoInfo`.`videoid` AS `t1_c10`, `videoInfo`.`faceimg` AS `t1_c11`, `videoInfo`.`status` AS `t1_c12`, `videoInfo`.`cTime` AS `t1_c13`, `videoInfo`.`qiniu720` AS `t1_c14`, `videoInfo`.`qiniuPFId` AS `t1_c15`, `videoInfo`.`qiniuPFSucc` AS `t1_c16` FROM `pre_dy_video` `t` LEFT OUTER JOIN `pre_videos` `videoInfo` ON (`t`.`video_url`=`videoInfo`.`id`) WHERE ((s_status=0) AND (id!=:ycp4)) ORDER BY t.id desc LIMIT 19

/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

#6
+
 /home/wwwroot/tell1/protected/models/DyVideo.php(148): CActiveRecord->findAll(CDbCriteria)
143             $criteria->addColumnCondition(['areaid'=>$areaid]);
144         }
145         if (!empty($excludeId)) {
146             $criteria->addNotInCondition('id', $excludeId);
147         }
148         $data = self::model()->findAll($criteria);
149         if (!is_null($areaid) && ($count = count($data)) < $len) {
150             foreach ($data as $_d){
151                 $ids[] = $_d['id'];
152             }
153             $data = array_merge($data, self::getDataList($len - $count, null, $ids));
#7
+
 /home/wwwroot/tell1/protected/models/DyVideo.php(153): DyVideo->getDataList(19, null, array("18"))
148         $data = self::model()->findAll($criteria);
149         if (!is_null($areaid) && ($count = count($data)) < $len) {
150             foreach ($data as $_d){
151                 $ids[] = $_d['id'];
152             }
153             $data = array_merge($data, self::getDataList($len - $count, null, $ids));
154         }
155         return $data;
156     }
157 }
#8
+
 /home/wwwroot/tell1/protected/controllers/IndexController.php(269): DyVideo->getDataList(20, "100604")
264 
265         //大客户
266         $bigCust = Bigcust::getDataList(20, $this->areaInfo['id']?:null);
267 
268         //抖音视频
269         $dyVideo = DyVideo::getDataList(20, $this->areaInfo['id']?:null);
270 
271         //选择到有景点的地区显示数据
272         $index_are = Position::findArea($areaInfo);
273 
274         //地区热门求婚地点
2020-01-23 06:32:38 nginx/1.10.0 Yii Framework/1.1.17
Baidu
sogou