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 product.appear IN ('Both','Web'))' at line 1. The SQL statement executed was: SELECT `t`.`product_id` AS `t0_c0`, `t`.`route_id` AS `t0_c1`, `t`.`price` AS `t0_c2`, `product`.`product_id` AS `t1_c0`, `product`.`name` AS `t1_c1`, `product`.`model` AS `t1_c2`, `product`.`sole` AS `t1_c3`, `product`.`price` AS `t1_c4`, `product`.`thumbnail` AS `t1_c5`, `product`.`image` AS `t1_c6`, `product`.`profile_image` AS `t1_c7`, `product`.`gender` AS `t1_c8`, `product`.`popup_id` AS `t1_c9`, `product`.`visible` AS `t1_c10`, `product`.`appear` AS `t1_c11`, `product`.`type` AS `t1_c12` FROM `product_to_route` `t` LEFT OUTER JOIN `product` `product` ON (`t`.`product_id`=`product`.`product_id`) AND (visible = 'All') WHERE (product.type = 'accessory' AND route_id = AND product.appear IN ('Both','Web'))

/home/phwpmiqf4e52/domains/bespoke.stubbsandwootton.com/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

#6
+
 /home/phwpmiqf4e52/domains/bespoke.stubbsandwootton.com/html/protected/controllers/RouteController.php(53): CActiveRecord->findAll(array("condition" => "product.type = 'accessory' AND route_id = AND product.appear IN..."))
48         $path = Yii::app()->getRequest()->getPathInfo();
49         $path = explode("/", $path);
50 
51         $route = Route::model()->findByAttributes(array("handle" => end($path), 'delete_at' => null, 'type' => 'accessory'));
52 
53         $options['accessories'] = SlipperRoute::model()->with('product:visible')->findAll(['condition' => "product.type = 'accessory' AND route_id = " . $route->route_id . " AND product.appear IN ('Both','Web')"]);
54 
55         if ($route && count($options['accessories']) == 1) {
56             $options['accessories'] = $options['accessories'][0];
57             $this->setPageTitle("Stubbs and Wootton - Bespoke - " . $route['name']);
58 
#16
+
 /home/phwpmiqf4e52/domains/bespoke.stubbsandwootton.com/html/index.php(16): CApplication->run()
11 defined('YII_DEBUG') or define('YII_DEBUG',true);
12 // specify how many levels of call stack should be shown in each log message
13 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
14 
15 require_once($yii);
16 Yii::createWebApplication($config)->run();
2024-03-28 20:04:22 Apache Yii Framework/1.1.14