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 elements.model_name='CatalogRubrics') OR (elements.model_id='6949' AND eleme' at line 1

/var/www/avel-m/data/www/framework/yiilite.php(9431)

9419     {
9420         if($this->_statement==null)
9421         {
9422             try
9423             {
9424                 $this->_statement=$this->getConnection()->getPdoInstance()->prepare($this->getText());
9425                 $this->_paramLog=array();
9426             }
9427             catch(Exception $e)
9428             {
9429                 Yii::log('Error in preparing SQL: '.$this->getText(),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
9430                 $errorInfo=$e instanceof PDOException ? $e->errorInfo : null;
9431                 throw new CDbException(Yii::t('yii','CDbCommand failed to prepare the SQL statement: {error}',
9432                     array('{error}'=>$e->getMessage())),(int)$e->getCode(),$errorInfo);
9433             }
9434         }
9435     }
9436     public function cancel()
9437     {
9438         $this->_statement=null;
9439     }
9440     public function bindParam($name, &$value, $dataType=null, $length=null, $driverOptions=null)
9441     {
9442         $this->prepare();
9443         if($dataType===null)

Stack Trace

#5
+
 /var/www/avel-m/data/www/app/models/CatalogDiscountRubrics.php(170): CActiveRecord->findAll(CDbCriteria)
165         $criteria->addCondition("(elements.model_id=$rubricsId AND elements.model_name='CatalogRubrics') OR (elements.model_id='$elementId' AND elements.model_name='CatalogElements')");
166         $criteria->compare('t.status_on', self::STATUS_ON);
167         $criteria->addCondition('((t.date_start <= ' . time() . ' OR t.date_start IS NULL) AND (t.date_end >= ' . time() . ' OR t.date_end IS NULL))');
168         $criteria->addInCondition('users.user_id', is_array($userId) ? $userId : [$userId]);
169 
170         return CatalogDiscountRubrics::model()->findAll($criteria);
171 
172     }
173 
174     public function setDiscountUsersValue()
175     {
#6
+
 /var/www/avel-m/data/www/app/apps/frontend/modules/catalog/controllers/CatalogmanufacturerController.php(236): CatalogDiscountRubrics::getUserDiscountByElement(null, 6949, 0)
231         if (!$settings->options) {
232             $settings->options = 643;
233         }
234         for ($i = 0; $i < count($data['elements']); $i++) {
235             $parent = CatalogRubrics::model()->findByPk($data['elements'][$i]['parent_id']);
236             $discounts = CatalogDiscountRubrics::getUserDiscountByElement($parent->id, (int)$data['elements'][$i]['id'],
237                 $user_id);
238             $price = $data['elements'][$i]['price'];
239             if (count($discounts)) {
240                 $data['elements'][$i]['price_old'] = $data['elements'][$i]['price'];
241                 foreach ($discounts as $discount) {
#19
+
 /var/www/avel-m/data/www/avel-m.ru/index.php(6): CApplication->run()
1 <?php
2 
3 require_once( __DIR__ . '/../app/config/settings.php' );
4 require_once( __DIR__ . '/../framework/yiilite.php');
5 
6 Yii::createWebApplication( __DIR__ . '/../app/config/frontend.php' )->run();
2024-03-29 02:42:03 Apache Yii Framework/1.1.18