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 ') LEFT OUTER JOIN `tbl_image` `main_img` ON (`main_img`.`id_product`=`t`.`id_pr' at line 1. The SQL statement executed was: SELECT COUNT(DISTINCT `t`.`id_product`) FROM `tbl_product` `t` INNER JOIN `tbl_category_product` `cat` ON (`cat`.`id_product`=`t`.`id_product`) AND (cat.id_category=) LEFT OUTER JOIN `tbl_image` `main_img` ON (`main_img`.`id_product`=`t`.`id_product`) AND (num=1) LEFT OUTER JOIN `tbl_product_lang` `product_lang` ON (`product_lang`.`id_product`=`t`.`id_product`) AND (product_lang.id_lang=2) LEFT OUTER JOIN `tbl_unit_sale_lang` `unit_sale` ON (`unit_sale`.`id_unit_sale`=`t`.`id_unit_sale`) AND (unit_sale.id_lang=2) WHERE (t.active=1)

/var/www/html/www.casatorres.com/private/yii-1.1.13.e9e4a0/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

#6
+
 /var/www/html/www.casatorres.com/webspace/protected/controllers/SiteController.php(48): CDataProvider->getTotalItemCount()
43         if($total==0) $this->typeList="product";
44         
45         $products=new Product('search');
46         $products->unsetAttributes(); 
47         $products->idcat=$category->id_category;
48         $totalProducts=$products->searchList()->getTotalItemCount();
49         Yii::app()->session['breadcrumb']=$category->id_category;
50         
51         $model->numElements=42;
52         $products->numElements=42;
53         $this->render('listCategory',array('model'=>$model,'products'=>$products,'category'=>$category,'total'=>$total,'totalProducts'=>$totalProducts));
#14
+
 /var/www/html/www.casatorres.com/webspace/index.php(15): CApplication->run()
10 // specify how many levels of call stack should be shown in each log message
11 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
12 
13 require_once($yii);
14 
15 Yii::createWebApplication($config)->run();
16 
17         Yii::import('ext.yiiexcel.YiiExcel', true);
18         Yii::registerAutoloader(array('YiiExcel', 'autoload'), true);
19 ?>
2024-03-19 08:39:41 Apache Yii Framework/1.1.13