CDbException

CDbCommand 无法执行 SQL 语句: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'wid' in 'where clause'. The SQL statement executed was: SELECT COUNT(*) FROM `product` `t` WHERE wid=47

/www/wwwroot/nuoyuanpy_com/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
+
 /www/wwwroot/nuoyuanpy_com/web/themes/default/views/content/index_peiyin.php(55): CActiveRecord->count(CDbCriteria)
50               case 4:$sql = 'lid=' . $this->cate['id'];
51                 break;
52               default: $sql = 1;
53             }
54             $criteria->condition = $sql;
55             $count = Product::model()->count($criteria);
56             $criteria1 = clone $criteria;
57             $criteria2 = clone $criteria;
58             $criteria1->addCondition('sex=1');
59             $criteria2->addCondition('sex=0');
60             $count1 = Product::model()->count($criteria1);
#7
+
 /www/wwwroot/nuoyuanpy_com/web/protected/controllers/ContentController.php(48): CController->render("index_peiyin")
43     $this->seoDescription = $this->cate['description'] ? $this->cate['description'] : $this->seoDescription;
44 
45     if ($tpl == '') {
46       $tpl = 'list';
47     }
48     $this->render($tpl);
49   }
50 
51   public function actionView($cid, $id) {
52     $cid = intval($cid);
53     $id = intval($id);
#15
+
 /www/wwwroot/nuoyuanpy_com/web/common.php(14): CApplication->run()
09 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3);
10 require_once($yii);
11 $app = Yii::createWebApplication($config);
12 require_once($globals);
13 
14 $app->run();
2024-03-29 20:42:14 nginx/1.22.1 Yii Framework/1.1.19