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 'GROUP BY brand_id HAVING enable = "1" ORDER BY _tent_member DESC LIMIT 10' at line 1. The SQL statement executed was: SELECT brand_id, enable, COUNT(*) _tent_member FROM `car_carlist` `t` WHERE tent_id = GROUP BY brand_id HAVING enable = "1" ORDER BY _tent_member DESC LIMIT 10

/home/cmcar/domains/cmusedcar.com/public_html/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/cmcar/domains/cmusedcar.com/public_html/protected/components/ShopVip.php(90): CActiveRecord->findAll(CDbCriteria)
85         $criteria->condition = 'tent_id ='.$this->shop->id;
86         $criteria->group = 'brand_id';
87         $criteria->having = 'enable = "1"';
88         $criteria->order = '_tent_member DESC';
89         $criteria->limit = 10;
90         $this->band_featured = Carlist::model()->findAll($criteria);
91     }
92     
93     protected function setTemplate(){
94         $theme = Template::model()->findByAttributes(array('path'=>$this->template));
95         if(!empty($theme)){
#4
+
 /home/cmcar/domains/cmusedcar.com/public_html/protected/components/ShopVip.php(40): ShopVip->get_band_featured()
35             $this->tentId = $_SERVER['SERVER_NAME'];
36             $this->tentId = str_replace('www.', '', $this->tentId);
37             $this->tentId = str_replace('.cmusedcar.com', '', $this->tentId);
38         }
39         $this->getData();
40         $this->get_band_featured();
41         $this->template = $this->shop->template_path;
42         //Yii::app()->theme = 'default';
43         Yii::app()->name = $this->shop->tent_name;
44         $this->setTemplate();
45         $this->setDefault();
#5
+
 /home/cmcar/domains/cmusedcar.com/public_html/protected/controllers/ShopsController.php(24): ShopVip->init()
19         '2'=>array('post_date'=>CSort::SORT_DESC),
20         '3'=>array('price'=>CSort::SORT_DESC),
21         '4'=>array('price'=>CSort::SORT_ASC)
22     );
23     public function init() {
24         parent::init();
25         $this->shopURL = (!$this->shop->domain)? 'http://'.$this->shop->username.'.cmusedcar.com' : 'http://www.'.$this->shop->domain;
26     }
27     
28     public function actions(){
29         return array(
2024-03-19 18:42:03 Apache/2 Yii Framework/1.1.16