CDbException

CDbCommand 无法执行 SQL 语句: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'html' in 'where clause'. The SQL statement executed was: SELECT COUNT(*) FROM `dym_video` `t` WHERE (lang ='zh_cn' and status =1) AND (type_id=html)

/home/wwwroot/www.cbo.cn/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

#2
+
 /home/wwwroot/www.cbo.cn/protected/controllers/VideoController.php(94): CActiveRecord->count(CDbCriteria)
89         if($vid && !empty($vid)){
90             $criteria->addCondition('type_id='.$vid,'AND'); 
91         }
92 
93         $criteria->order = 't.order DESC,t.id desc';
94         $data['count'] = $model->count($criteria);
95         $pages = new CPagination($data['count']);
96         $pages->pageSize = 10;
97         $pages->currentPage =  $page?($page-1):0;
98         $criteria->limit = $pages->pageSize;
99         $criteria->offset = $pages->currentPage * $pages->pageSize;
#10
+
 /home/wwwroot/www.cbo.cn/index.php(17): CApplication->run()
12 
13 //defined('YII_ENABLE_EXCEPTION_HANDLER') or define('YII_ENABLE_EXCEPTION_HANDLER',false);  
14 //defined('YII_ENABLE_ERROR_HANDLER') or define('YII_ENABLE_ERROR_HANDLER',false);  
15 require_once($yii);
16 
17 Yii::createWebApplication($config)->run();
18 
2024-03-29 19:34:50 nginx/1.14.0 Yii Framework/1.1.14