CDbException

CDbCommand не удалось исполнить SQL-запрос: SQLSTATE[42000]: Syntax error or access violation: 1064 . The SQL statement executed was: SELECT title FROM san_category WHERE status = 1 AND id =

/var/www/vhosts/u0088840.plsk.regruhosting.ru/httpdocs/saki-burdenko.ru/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

#2
+
 /var/www/vhosts/u0088840.plsk.regruhosting.ru/httpdocs/saki-burdenko.ru/protected/models/News.php(132): CActiveRecord->findBySql("SELECT title FROM {{category}} WHERE status = 1 AND id = ")
127       
128     }  
129     
130     public static function title_cat($id)
131     {
132         $parent = Category::model()->findBySql('SELECT title FROM {{category}} WHERE status = 1 AND id = '.$id.'');
133             if($parent === NULL)
134                 throw new CHttpException(404,'нет категории для отображения');
135                 $array = $parent->title;
136         return $array;
137     }
#3
+
 /var/www/vhosts/u0088840.plsk.regruhosting.ru/httpdocs/saki-burdenko.ru/themes/online/views/layouts/page/single-post.php(4): News::title_cat(null)
1 <?php $this->beginContent('//layouts/main');?>
2     <?php 
3     if($this->id == 'news'){
4         $this->breadcrumbs=array(News::title_cat($this->_new->parent_id)=>array('/'.$this->_category->alias.''),
5         $this->_new->title,);
6     }
7     if($this->id == 'articles'){
8         $this->breadcrumbs=array('Все статьи'=>array('/'.$this->_category->alias.''),
9         $this->_new->title,);
#7
+
 /var/www/vhosts/u0088840.plsk.regruhosting.ru/httpdocs/saki-burdenko.ru/protected/controllers/NewsController.php(38): CController->render("view", array("model" => null))
33     {
34         $news = News::model()->findByPk($id);
35         $_new = $news;
36         $this->layout = '//layouts/page/single-post';
37         $this->render('view',array(
38             'model'=>$news,
39         ));
40     }
41 
42     public function actionIndex()
43     {
2024-03-29 03:30:39 Apache Yii Framework/1.1.17