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 '' at line 3. The SQL statement executed was: SELECT COUNT(*) FROM `ore_apartment` `t` INNER JOIN ore_apartment_metro_stations ON ore_apartment_metro_stations.apartment_id=t.id
INNER JOIN ore_metro_stations as ms ON ms.id=ore_apartment_metro_stations.metro_id WHERE t.type=1 and (t.city_id=7 or t.city_id=524894)
and obj_type_id = 8 and autoTwitterPostId=

/var/www/bazametrov/data/www/bazametrov.ru/framework/yiilite.php(9674)

9662             return $result;
9663         }
9664         catch(Exception $e)
9665         {
9666             if($this->_connection->enableProfiling)
9667                 Yii::endProfile('system.db.CDbCommand.query('.$this->getText().$par.')','system.db.CDbCommand.query');
9668             $errorInfo=$e instanceof PDOException ? $e->errorInfo : null;
9669             $message=$e->getMessage();
9670             Yii::log(Yii::t('yii','CDbCommand::{method}() failed: {error}. The SQL statement executed was: {sql}.',
9671                 array('{method}'=>$method, '{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
9672             if(YII_DEBUG)
9673                 $message.='. The SQL statement executed was: '.$this->getText().$par;
9674             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
9675                 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
9676         }
9677     }
9678     public function buildQuery($query)
9679     {
9680         $sql=!empty($query['distinct']) ? 'SELECT DISTINCT' : 'SELECT';
9681         $sql.=' '.(!empty($query['select']) ? $query['select'] : '*');
9682         if(!empty($query['from']))
9683             $sql.="\nFROM ".$query['from'];
9684         if(!empty($query['join']))
9685             $sql.="\n".(is_array($query['join']) ? implode("\n",$query['join']) : $query['join']);
9686         if(!empty($query['where']))

Stack Trace

#2
+
 /var/www/bazametrov/data/www/bazametrov.ru/protected/modules/subcategories/controllers/MainController.php(247): CActiveRecord->count(CDbCriteria)
242              INNER JOIN ore_metro_stations as ms ON ms.id=ore_apartment_metro_stations.metro_id";
243         }
244                 
245         $cat=$this->cat[$obj_type_id]."/".$suburl;
246         /*проверка на пейджи*/
247         $res=Apartment::model()->count($criteria);
248         $respage=(int)(($res+ConfigurationModel::getcountListitngblock()-1)/ConfigurationModel::getcountListitngblock());
249         
250         /*убираем next если нет стр*/
251         if(isset($_GET['page']) && $_GET['page']>=$respage){
252             Yii::app()->params['rel_next']=''; 
#19
+
 /var/www/bazametrov/data/www/bazametrov.ru/index.php(166): CApplication->run()
161     return $md->isMobile();
162 }
163 
164 require_once($yii);
165 
166 Yii::createWebApplication($config)->run();
2024-03-29 13:06:38 Apache/2.4.7 (Ubuntu) Yii Framework/1.1.21