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 c.active = 1 ORDER BY c.path_names' at line 3. The SQL statement executed was: SELECT c.*,
(SELECT COUNT(1) FROM app_goods g1 WHERE g1.category_id = c.category_id AND g1.active = 1 AND g1.brand = :brand) AS `cnt`
FROM app_category c WHERE c.category_id IN () AND c.active = 1 ORDER BY c.path_names. Bound with :brand=''

/var/www/www-root/data/www/baltelectron.ru/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
+
 /var/www/www-root/data/www/baltelectron.ru/protected/classes/modules/common_catalog/catalog.module.php(101): CDbCommand->queryAll(true, array(":brand" => ""))
096     $r = Yii::app()->db->createCommand('SELECT categories FROM app_cache_brand WHERE brand = :brand')->queryScalar(array(':brand'=>$p_brand));
097     $ids = explode('|',trim($r,'|'));
098 
099     $data = Yii::app()->db->createCommand('SELECT c.*,
100       (SELECT COUNT(1) FROM app_goods g1 WHERE g1.category_id = c.category_id AND g1.active = 1 AND g1.brand = :brand) AS `cnt`
101       FROM app_category c WHERE c.category_id IN ('.implode(',',$ids).') AND c.active = 1 ORDER BY c.path_names')->queryAll(true,array(':brand'=>$p_brand));
102 
103     if(!$p_container_template) {
104       $p_container_template = '<ul>%%list%%</ul>';
105     }
106 
#2
+
 /var/www/www-root/data/www/baltelectron.ru/design/templates/modules/common_catalog/catalog.view.php(35): CCatalogModule->renderBrandcategories("")
30       switch(F_ARRAY_ITEM($fields, 'mode')) {
31         case CCatalogModule::MODE_CATEGORY:
32           $tpl_subcategories = $module->renderSubcategories(F_ARRAY_ITEM($fields, 'category'));
33           break;
34         case CCatalogModule::MODE_BRAND:
35           $tpl_subcategories = $module->renderBrandcategories(F_ARRAY_ITEM($fields, 'brand_name'));
36           break;
37         default:
38           $tpl_subcategories = false;
39       }
40 
#3
+
 /var/www/www-root/data/www/baltelectron.ru/protected/classes/modules/common_catalog/view/catalog.view.php(1): require_once("/var/www/www-root/data/www/baltelectron.ru/design/templates/modu...")
1 <?php require_once(Yii::app()->basePath.'/..'.Yii::app()->params->DesignDirWeb.'templates/modules/common_catalog/catalog.view.php');
2024-03-28 15:52:20 Apache/2.2.15 (CentOS) Yii Framework/1.1.17