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 ')) AND (date >= "2024-03-28" AND date < "2024-04-26")) AND (close='0') LIMIT 1' at line 1. The SQL statement executed was: SELECT * FROM `rooms` `t` WHERE ((roomtype_id in ()) AND (date >= "2024-03-28" AND date < "2024-04-26")) AND (close=:ycp0) LIMIT 1

/var/www/harmonysaigonhotel.com/public_html/yii/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

#3
+
 /var/www/harmonysaigonhotel.com/public_html/protected/models/Rooms.php(200): CActiveRecord->find()
195             'criteria' => $criteria,
196             'sort' => array('defaultOrder' => 'date ASC')
197         ));
198         $dataProvider->setPagination(false);
199         return $dataProvider->getData();*/
200         $dataProvider=Rooms::model()->find($criteria);
201         return $dataProvider;
202     }
203 
204     public function getTotalRoomByHotel($hotel, $fromDate, $toDate){
205         $criteria = new CDbCriteria;
#4
+
 /var/www/harmonysaigonhotel.com/public_html/protected/models/Promotion.php(329): Rooms->getAvailableIn1Month()
324             $checkin = date('Y-m-d');
325             $checkout = date('Y-m-d', strtotime("$checkin +".$pr['min_stay']." day"));
326         }
327         $to = date('Y-m-d', strtotime("$checkin +29 day"));
328         $params2=array('fromDate'=>$checkin, 'toDate'=>$to, 'roomtype'=>$pr['roomtypes']);
329         $room = Rooms::model()->getAvailableIn1Month($params2, $pr['hotel_id']);
330         //echo "<pre>";print_r($rooms);die;
331         if(isset($rooms) && count($rooms->getData())>0){
332             $params = array(
333                 'checkin' => $room['date'],
334                 'checkout' => date('Y-m-d', strtotime($room['date'] ." +".$pr['min_stay']." day")),
#5
+
 /var/www/harmonysaigonhotel.com/public_html/protected/views/promotion/detail.php(12): Promotion->checkRatePromo()
07     $to_date = date('Y-m-d', strtotime("$from +29 day"));
08     $rates=array();
09     $getHotel = Hotel::model()->find();
10     
11     $params = array();
12     $price = Promotion::model()->checkRatePromo($params, $model);
13 ?>
14 
15 <div class="room-detail-page">
16     <div class="booking-title-box">
17         <div class="booking-title-box-inner container">
2024-03-28 15:28:33 Apache/2.4.41 (Ubuntu) Yii Framework/1.1.28