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 MySQL server version for the right syntax to use near 'ORDER BY section_id DESC LIMIT 1' at line 1. The SQL statement executed was: SELECT * FROM `sections` `t` WHERE section_id = ORDER BY section_id DESC LIMIT 1

/home/p186930/www/poisknn.ru/framework/db/CDbCommand.php(528)

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

Stack Trace

#3
+
 /home/p186930/www/poisknn.ru/protected/controllers/ArticlesController.php(27): CActiveRecord->find(array("order" => "section_id DESC", "condition" => "section_id = "))
22         
23         
24         
25         $artsectionids = Yii::app() -> db -> createCommand('SELECT id2 FROM links WHERE relation="article2section" AND id1 = ' . $articles_item -> articles_id ) -> queryColumn();
26         $artsectionid = $artsectionids[0];
27         $parentsection = Section::model()->find(array('order' => 'section_id DESC', 'condition' => 'section_id = '.$artsectionid));
28         
29         $addartfeedids = Yii::app() -> db -> createCommand('SELECT id1 FROM links WHERE relation="article2section" AND id2 = '.$parentsection -> section_id ) -> queryColumn();
30         
31         $addartfeed = Articles::model()->findAll(array('order' => 'articles_id DESC', 'limit' => '3' , 'condition' => '(articles_id IN (' . join(',', $addartfeedids ) . ')) AND (articleopen = 1) AND articles_id != '.$articles_item -> articles_id));
32         
#13
+
 /home/p186930/www/poisknn.ru/index.php(16): CApplication->run()
11 defined('YII_DEBUG') or define('YII_DEBUG',true);
12 // specify how many levels of call stack should be shown in each log message
13 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
14 
15 require_once($yii);
16 Yii::createWebApplication($config)->run();
2024-03-28 13:44:12 LiteSpeed Yii Framework/1.1.9