CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY cdate desc LIMIT 5' at line 1. The SQL statement executed was: SELECT * FROM `tbarticle` `t` WHERE typeid='' AND id<> ORDER BY cdate desc LIMIT 5

D:\xampp\htdocs\istudent\framework\yiilite.php(9595)

9583             return $result;
9584         }
9585         catch(Exception $e)
9586         {
9587             if($this->_connection->enableProfiling)
9588                 Yii::endProfile('system.db.CDbCommand.query('.$this->getText().$par.')','system.db.CDbCommand.query');
9589             $errorInfo=$e instanceof PDOException ? $e->errorInfo : null;
9590             $message=$e->getMessage();
9591             Yii::log(Yii::t('yii','CDbCommand::{method}() failed: {error}. The SQL statement executed was: {sql}.',
9592                 array('{method}'=>$method, '{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
9593             if(YII_DEBUG)
9594                 $message.='. The SQL statement executed was: '.$this->getText().$par;
9595             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
9596                 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
9597         }
9598     }
9599     public function buildQuery($query)
9600     {
9601         $sql=!empty($query['distinct']) ? 'SELECT DISTINCT' : 'SELECT';
9602         $sql.=' '.(!empty($query['select']) ? $query['select'] : '*');
9603         if(!empty($query['from']))
9604             $sql.="\nFROM ".$query['from'];
9605         if(!empty($query['join']))
9606             $sql.="\n".(is_array($query['join']) ? implode("\n",$query['join']) : $query['join']);
9607         if(!empty($query['where']))

Stack Trace

#3
 D:\xampp\htdocs\istudent\protected\controllers\ArticleCmsController.php(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code(18): CActiveRecord->findAll(CDbCriteria)
#13
+
 D:\xampp\htdocs\istudent\index.php(22): CApplication->run()
17 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
18 
19 define("ABS_PATH", dirname(__FILE__));
20 
21 require_once($yii);
22 Yii::createWebApplication($config)->run();
2024-03-28 21:30:44 Apache/2.4.16 (Win32) OpenSSL/1.0.1p PHP/5.5.28 Yii Framework/1.1.18