CDbException

CDbCommand không thể thi hành câu truy vấn 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 'ORDER BY t.kind ASC, t.ord ASC, t.id DESC' at line 1. The SQL statement executed was: SELECT * FROM `type` `t` WHERE t.active = 1 AND t.parent = 0 AND cat_id = ORDER BY t.kind ASC, t.ord ASC, t.id DESC

/home/tiencuonghp/public_html/framework/db/CDbCommand.php(518)

506             return $result;
507         }
508         catch(Exception $e)
509         {
510             if($this->_connection->enableProfiling)
511                 Yii::endProfile('system.db.CDbCommand.query('.$this->getText().$par.')','system.db.CDbCommand.query');
512             $errorInfo = $e instanceof PDOException ? $e->errorInfo : null;
513             $message = $e->getMessage();
514             Yii::log(Yii::t('yii','CDbCommand::{method}() failed: {error}. The SQL statement executed was: {sql}.',
515                 array('{method}'=>$method, '{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
516             if(YII_DEBUG)
517                 $message .= '. The SQL statement executed was: '.$this->getText().$par;
518             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
519                 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
520         }
521     }
522 
523     /**
524      * Builds a SQL SELECT statement from the given query specification.
525      * @param array $query the query specification in name-value pairs. The following
526      * query options are supported: {@link select}, {@link distinct}, {@link from},
527      * {@link where}, {@link join}, {@link group}, {@link having}, {@link order},
528      * {@link limit}, {@link offset} and {@link union}.
529      * @return string the SQL statement
530      * @since 1.1.6

Stack Trace

#3
+
 /home/tiencuonghp/public_html/protected/models/Type.php(173): CActiveRecord->findAll(array("condition" => "t.active = 1 AND t.parent = 0 AND cat_id = ", "order" => "t.kind ASC, t.ord ASC, t.id DESC"))
168     public function getTypeByCat($cat_id)
169     {
170         return self::model()->findAll(array(
171         'condition' => 't.active = 1 AND t.parent = 0 AND cat_id = ' . $cat_id,
172         'order' => 't.kind ASC, t.ord ASC, t.id DESC',
173         ));
174     }
175 
176     //lay ra danh muc cha
177     public function getAllTypeByCat($cat_id)
178     {
#4
+
 /home/tiencuonghp/public_html/protected/views/site/pages/listproduct_brand.php(94): Type->getTypeByCat(null)
89             <!--begin right-->
90             <div class="right">
91 
92                 <?php
93                 $cat_var = Cat::model()->findByPk($this->cat_id);
94                 $type_var = Type::getTypeByCat($cat_var->id);
95                 if (!empty($type_var)) {
96                     ?>
97                     <div class="_pbox subcat_pbox">
98                         <p><i class="fa fa-th-list"></i> <?=$cat_var->name; ?></p>
99                         <div>
#9
+
 /home/tiencuonghp/public_html/protected/controllers/SiteController.php(693): CController->render("pages/listproduct_brand", array("model" => array(Product, Product, Product, Product, ...), "pages" => CPagination, "count" => "49", "brand" => Brand))
688         $this->render('pages/listproduct_brand', array(
689         'model' => $model,
690         'pages' => $pages,
691         'count' => $count,
692         'brand' => $brand,
693         ));
694     }
695 
696     /*
697     * LIỆT KÊ SẢN PHẨM THEO THƯƠNG HIỆU & CHỦNG LOẠI
698     */
2024-03-19 07:30:23 LiteSpeed Yii Framework/1.1.7