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 'AND date_come >= 2024-03-01 AND `status` NOT IN ('canceled','new','confirmed')' at line 1. The SQL statement executed was: SELECT * FROM `orders` `t` WHERE desc_id = AND date_come >= 2024-03-01 AND `status` NOT IN ('canceled','new','confirmed')

/home/admin/web/adresa.md/public_html/YiiRoot_1.1.13/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

#3
+
 /home/admin/web/adresa.md/public_html/protected/controllers/MainController.php(160): CActiveRecord->findAll(array("condition" => "desc_id = AND date_come >= 2024-03-01 AND `status` NOT IN ('ca..."))
155         $this->metatitle = $model->meta_title ? $model->meta_title : $model->title;
156         $this->metadescription = $model->meta_description ? $model->meta_description : '';
157         $this->metakeywords = $model->meta_keywords;
158 
159 
160         $orders = Orders::model()->findAll(array("condition"=>"desc_id = $id AND date_come >= ".date('Y-m-01')." AND `status`  NOT IN ('canceled','new','confirmed')"));
161         
162         if(!empty($orders)){
163         $date_range = array();
164         foreach ($orders as $key => $value) {
165             $dateCome[] = date("Y-m-d", strtotime($value->date_come));
#11
+
 /home/admin/web/adresa.md/public_html/index.php(22): CApplication->run()
17 defined('YII_DEBUG') or define('YII_DEBUG',true);
18 // specify how many levels of call stack should be shown in each log message
19 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
20 
21 require_once($yii);
22 Yii::createWebApplication($config)->run();
23 ?>
2024-03-28 14:20:25 Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips mod_fcgid/2.3.9 PHP/5.6.38 Yii Framework/1.1.13