CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 't.category_id' in 'where clause'. The SQL statement executed was: SELECT COUNT(*) FROM `tbl_products` `t` WHERE t.category_id=:category_id AND t.published=1

/home3/ratushny/public_html/framework/db/CDbCommand.php(541)

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

Stack Trace

#2
+
 /home3/ratushny/public_html/protected/controllers/CategoryController.php(15): CActiveRecord->count(CDbCriteria)
10         
11         $criteria = new CDbCriteria();
12         $criteria->condition = 't.category_id=:category_id AND t.published=1';
13         $criteria->params = array(':category_id'=>$category->category_id);
14         
15         $count = Product::model()->count($criteria);
16         $pages = new CPagination($count);
17         $pages->applyLimit($criteria);
18         
19         $criteria->with = array('category','brand');
20         $dataProvider = new CActiveDataProvider('Product', array(
#12
+
 /home3/ratushny/public_html/index.php(13): CApplication->run()
08 defined('YII_DEBUG') or define('YII_DEBUG',true);
09 // specify how many levels of call stack should be shown in each log message
10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
11 
12 require_once($yii);
13 Yii::createWebApplication($config)->run();
2024-03-29 01:50:44 Apache Yii Framework/1.1.13