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 'ORDER BY from_quantity ASC' at line 1. The SQL statement executed was: SELECT from_quantity, price FROM `tbl_specific_price` `t` WHERE id_product= ORDER BY from_quantity ASC

/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

#3
+
 /var/www/html/www.casatorres.com/webspace/protected/models/SpecificPrice.php(70): CActiveRecord->findAll(CDbCriteria)
65         
66         $criteria->select = "from_quantity, price";
67         $criteria->addCondition("id_product=".$id);
68         $criteria->order = "from_quantity ASC";
69         
70         return SpecificPrice::model()->findAll($criteria);
71     }
72     
73     public static function getPrice($id,$q){
74         if(!empty($q)){
75             $price=SpecificPrice::model()->find(array('select'=>'from_quantity,price','condition'=>"id_product=$id and from_quantity<=$q",'order'=>'from_quantity DESC'));
#4
+
 /var/www/html/www.casatorres.com/webspace/protected/controllers/SiteController.php(77): SpecificPrice::getSpecificPrice(null)
72         Yii::app()->session['breadcrumb']="";
73 
74         $full_slug[]=$model->product_lang->name;
75                 
76         $review = ProductReview::getReviewWithIdProduct($model->id_product);
77         $specificPrice=SpecificPrice::getSpecificPrice($model->id_product);
78         if(isset($_GET['filter'])){
79             
80             $comb=ProductAttribute::getCombinations($model->id_product,$_GET['filter']);
81         }else{
82             $comb=ProductAttribute::getCombinations($model->id_product);
#12
+
 /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-29 06:43:37 Apache Yii Framework/1.1.13