CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-10, 20' at line 1. The SQL statement executed was: select r.rate,p.* from Ratings_archive_Rate2 r,Ratings_archive_Rating p where r.period='11_2018' and p.period='11_2018' and p.id=r.id order by r.rate LIMIT -10, 20

/var/www/webmaster/data/www/yii/framework/db/CDbCommand.php(541)

529         {
530             if($this->_connection->enableProfiling)
531                 Yii::endProfile('system.db.CDbCommand.query('.$this->getText().$par.')','system.db.CDbCommand.query');
532 
533             $errorInfo=$e instanceof PDOException ? $e->errorInfo : null;
534             $message=$e->getMessage();
535             Yii::log(Yii::t('yii','CDbCommand::{method}() failed: {error}. The SQL statement executed was: {sql}.',
536                 array('{method}'=>$method, '{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
537 
538             if(YII_DEBUG)
539                 $message.='. The SQL statement executed was: '.$this->getText().$par;
540 
541             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
542                 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
543         }
544     }
545 
546     /**
547      * Builds a SQL SELECT statement from the given query specification.
548      * @param array $query the query specification in name-value pairs. The following
549      * query options are supported: {@link select}, {@link distinct}, {@link from},
550      * {@link where}, {@link join}, {@link group}, {@link having}, {@link order},
551      * {@link limit}, {@link offset} and {@link union}.
552      * @return string the SQL statement
553      * @since 1.1.6

Stack Trace

#1
+
–
 /var/www/webmaster/data/www/millioner.ru/inc/views/inc/rating_archive.php(187): CDbCommand->query()
182       }
183     }
184     else
185     {
186       if (isset($rating1))
187         $res=Yii::app()->db->createCommand("select r.rate,p.* from Ratings_archive_Rate2 r,Ratings_archive_Rating p where r.period='".$period."' and p.period='".$period."' and p.id=r.id order by r.rate LIMIT ".$n1.", 20")->query();
188       else if (isset($rating2))
189           $res=Yii::app()->db->createCommand("select r.rate,p.* from Ratings_archive_Rate1 r,Ratings_archive_Rating p where r.period='".$period."' and p.period='".$period."' and p.id=r.id order by r.rate LIMIT ".$n1.", 20")->query();
190       else
191         $res=Yii::app()->db->createCommand("select * from Ratings_archive_Rating where period='".$period."' order by num LIMIT ".$n1.", 20")->query();
192     }
#5
+
–
 /var/www/webmaster/data/www/millioner.ru/inc/views/main/main.php(7): CController->renderPartial("/inc/rating_archive")
02 $this->beginWidget('window',array('title'=>$page->h1,'h1'=>true));
03 if ($page->inc_file)
04 {
05     //$this->widget($page->inc_file)->render();
06     //$this->renderPartial('/inc/'.$page->inc_file,array('model'=>new LoginForm)); 
07     $this->renderPartial('/inc/'.$page->inc_file);
08 }
09 else
10 {
11     echo $page->page_text;
12 }
#10
+
–
 /var/www/webmaster/data/www/millioner.ru/inc/controllers/MainController.php(146): CController->render("main", array("page" => Pages))
141         {
142             $this->layout="game";
143             $this->render('game',array('page'=>$page));
144         }
145         else
146             $this->render('main',array('page'=>$page));
147     }
148 }
149 
150 ?>
2024-03-29 16:07:45 Apache/2.4.6 (CentOS) mpm-itk/2.4.7-04 OpenSSL/1.0.2k-fips PHP/5.4.16 Yii Framework/1.1.13