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 'and type = 1 ORDER BY pri DESC' at line 1. The SQL statement executed was: SELECT * FROM `tbl_about` `t` WHERE teacher_id = and type = 1 ORDER BY pri DESC

/var/www/html/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

#3
+
 /var/www/html/protected/views/frontend/teachers/detail.php(54): CActiveRecord->findAll(array("condition" => "teacher_id = and type = 1", "order" => "pri DESC"))
49         </div>
50     </div>
51 </div>
52 <div class="row">
53 <div class="col-lg-4 col-lg-offset-2 col-md-5">
54     <? $type = About::model()->findAll(array('condition' => 'teacher_id = '.$detail->id.' and type = 1', 'order' => 'pri DESC')); ?>
55     <? if(count($type) > 0): ?>
56         <div class="block-box block-1">
57             <h3 class="text-uppercase">
58                 Где учился
59             </h3>
#8
+
 /var/www/html/protected/controllers/frontend/TeachersController.php(46): CController->render("detail", array("detail" => null))
41         $this->title = $detail->name ." | DANCE-COOL";
42         $this->keywords = $detail->name ."DANCE-COOL";
43         $this->description = $detail->name ." | DANCE-COOL";
44 
45         $this->render('detail', array(
46             'detail' => $detail,
47         ));
48     }
49 }
#23
+
 /var/www/html/protected/behaviors/WebApplicationEndBehavior.php(22): CApplication->run()
17 
18         // обрабатываем событие создания модуля
19         $this->onModuleCreate = array($this, 'changeModulePaths');
20         $this->onModuleCreate(new CEvent ($this->owner));
21 
22         $this->owner->run();
23     }
24     // обработчик события onModuleCreate
25     public function onModuleCreate($event)
26     {
27         $this->raiseEvent('onModuleCreate', $event);
2024-03-28 23:37:21 Apache/2.4.29 (Ubuntu) Yii Framework/1.1.16