CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1582 Incorrect parameter count in the call to native function 'RADIANS'. The SQL statement executed was:
SELECT
id, title,
(
6371 * ACOS(
COS(RADIANS()) * COS(RADIANS(latitude)) * COS(RADIANS(longtitude) - RADIANS()) + SIN(RADIANS()) * SIN(RADIANS(latitude))
)
) AS distance, weather_detail.*
FROM
weather_station
LEFT JOIN weather_detail ON weather_station.id = weather_detail.weather_station_id
WHERE (
SELECT COUNT(*) FROM weather_detail WHERE weather_station_id = weather_station.id
) > 0
ORDER BY distance ASC, timestamp DESC
LIMIT 1

/home/rentaballoonrace/web/rentaballoonrace.com/public_html/vendor/yiisoft/yii/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

#1
+
 /home/rentaballoonrace/web/rentaballoonrace.com/public_html/protected/service/WeatherService.php(41): CDbCommand->query()
36             ORDER BY distance ASC, timestamp DESC
37             LIMIT 1
38         ";
39 
40         $command = $connection->createCommand($sql);
41         $dataReader = $command->query();
42         $weather = $dataReader->readAll();
43 
44         $result = array();
45         foreach ($weather as $row) {
46             $result = $row;
#2
+
 /home/rentaballoonrace/web/rentaballoonrace.com/public_html/protected/controllers/RaceController.php(38): WeatherService::getWeather()
33         $ranking = RaceService::getRanking(Yii::app()->config->race->id, 100);
34 
35         $this->render('view', array(
36             'ranking' => $ranking,
37             'race' => Yii::app()->config->race,
38             'weather' => WeatherService::getWeather(Yii::app()->config->race->location->latitude, Yii::app()->config->race->location->longtitude)
39         ));
40     }
41 
42     public function actionLaunch() {
43 
#15
+
 /home/rentaballoonrace/web/rentaballoonrace.com/public_html/index.php(47): CApplication->run()
42 
43 if (getenv('APP_SHOW_ERRORS') == true) {
44     defined('YII_DEBUG') or define('YII_DEBUG', true);
45 }
46 
47 Yii::createWebApplication($config)->run();
2024-03-28 08:54:07 nginx/1.25.4 Yii Framework/1.1.25