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 '' at line 1. The SQL statement executed was: SELECT COUNT(*) FROM `news` `t` WHERE active = 1 AND cat_id =

/home/u482259721/domains/haiancontainer.com/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

#2
+
 /home/u482259721/domains/haiancontainer.com/public_html/protected/controllers/SiteController.php(115): CActiveRecord->count(CDbCriteria)
110         $this->navigation_bar = $this->navigation_bar . CHtml::link($cat->name, Yii::app()->urlManager->createUrl('site/ListNews', array('id' => $cat->id, 'name' => myExt::KhongDau($cat->name))),array('class'=>'last'));
111         
112         $criteria = new CDbCriteria();
113         $criteria->condition = 'active = 1 AND cat_id = ' . $cat->id;
114         $criteria->order = 't.id DESC';
115         $count=News::model()->count($criteria);
116         $pages=new CPagination($count);
117         $pages->route = 'site/ListNews';
118     
119         // results per page
120         $pages->pageSize=$this->new_perpage;
#12
+
 /home/u482259721/domains/haiancontainer.com/public_html/index.php(20): CApplication->run()
15 defined('YII_DEBUG') or define('YII_DEBUG',true);
16 // specify how many levels of call stack should be shown in each log message
17 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
18 
19 require_once($yii);
20 Yii::createWebApplication($config)->run();
2024-03-19 11:44:46 LiteSpeed Yii Framework/1.1.7