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 MySQL server version for the right syntax to use near '>0 and lang = 1 ORDER BY point DESC, `time` ASC LIMIT 3' at line 1. The SQL statement executed was: SELECT * FROM toplist WHERE time > '2024-03-25 00:00:00' AND stat_type = 1 AND rank>0 and lang = 1 ORDER BY point DESC, `time` ASC LIMIT 3

/var/www/html/oyunus/framework/db/CDbCommand.php(528)

516             return $result;
517         }
518         catch(Exception $e)
519         {
520             if($this->_connection->enableProfiling)
521                 Yii::endProfile('system.db.CDbCommand.query('.$this->getText().$par.')','system.db.CDbCommand.query');
522             $errorInfo = $e instanceof PDOException ? $e->errorInfo : null;
523             $message = $e->getMessage();
524             Yii::log(Yii::t('yii','CDbCommand::{method}() failed: {error}. The SQL statement executed was: {sql}.',
525                 array('{method}'=>$method, '{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
526             if(YII_DEBUG)
527                 $message .= '. The SQL statement executed was: '.$this->getText().$par;
528             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
529                 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
530         }
531     }
532 
533     /**
534      * Builds a SQL SELECT statement from the given query specification.
535      * @param array $query the query specification in name-value pairs. The following
536      * query options are supported: {@link select}, {@link distinct}, {@link from},
537      * {@link where}, {@link join}, {@link group}, {@link having}, {@link order},
538      * {@link limit}, {@link offset} and {@link union}.
539      * @return string the SQL statement
540      * @since 1.1.6

Stack Trace

#1
+
 /var/www/html/oyunus/protected/bo/GameBO.php(471): CDbCommand->query()
466         $topScorers = array();
467         
468         // HIGHEST GAME POINT
469         $sql = "SELECT * FROM toplist WHERE $checkPeriod stat_type = 1 AND  rank>0 and  lang = $lang ORDER BY point DESC, `time` ASC LIMIT 3";     
470         $command = $connection->createCommand($sql);
471         $dataReader = $command->query();
472         $cnt = 0;
473         while (($row = $dataReader->read()) != false) {
474             $topScorers[1][$cnt]['userid'] = $row['userid'];
475             $record = UserDTO::model()->findByAttributes(array('userid' => $row['userid']));
476             $topScorers[1][$cnt]['avatarconfirm'] = $record->usr_avatar_confirm;
#2
+
 /var/www/html/oyunus/protected/models/Game.php(436): GameBO->loadTopScores()
431     public function loadWeeklyBest($lang = 0) {
432         $this->topScorers = $this->_gameBO->loadWeeklyBest($lang);
433     }
434     
435     public function loadTopScores($period = 'week', $lang = 0) {
436         $this->topScorers = $this->_gameBO->loadTopScores($period, $lang);
437     }
438     
439     public function loadTopScoresType($period, $type, $lang) {
440         $this->topScorers = $this->_gameBO->loadTopScoresType($period, $type, $lang);
441     }
#3
+
 /var/www/html/oyunus/protected/controllers/GamesController.php(881): Game->loadTopScores()
876         if(Yii::app()->getLanguage() == "en_US") 
877             $cur_lang = 1;
878         elseif(Yii::app()->getLanguage() == "ar_AR")
879             $cur_lang=2;
880         
881         $model->loadTopScores('week',$cur_lang);
882 
883         // get user game stats
884         $model->getMyRatsSes();
885         
886         if($layout!='')
2024-03-29 11:32:11 Apache/2.4.37 (AlmaLinux) OpenSSL/1.1.1k Yii Framework/1.1.10