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 display_in_website=1 order by id desc limit 0, 12' at line 1. The SQL statement executed was: select * from suri_item_details_images where category_id= and display_in_website=1 order by id desc limit 0, 12

/home/zd3tptgsk5kc/public_html/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
+
 /home/zd3tptgsk5kc/public_html/surigraphics/protected/views/site/itemlist.php(30): CDbCommand->queryAll()
25                     {
26                             $get_id = 1;
27                     }
28                     // select first 12 posts
29                     $query = "select * from suri_item_details_images where category_id=".$category->id." and display_in_website=1 order by id desc limit $start_num, $limit_num ";
30                     $result = Yii::app()->db->createCommand("$query")->queryAll();
31 
32                     foreach ($result as $row) {
33                         $id = $row['id'];
34                         $product_img = $row['product_img'];
35                         $category_id = $row['category_id'];
#6
+
 /home/zd3tptgsk5kc/public_html/surigraphics/protected/controllers/SiteController.php(199): CController->render("itemlist", array("category" => null, "category_class_id" => "2"))
194         $category_class_id = $_GET['category_class_id'];
195         $category_id = $_GET['category_id'];
196 
197         $this->pageTitle = "Suri Graphics - Item List";
198         $category = Itemcategory::model()->findByPk($category_id);
199         $this->render('itemlist', array("category" => $category, 'category_class_id' => $category_class_id));
200     }
201 
202     public function actionService_itemlist() {
203         $this->layout = "front";
204         $category_class_id = $_GET['category_class_id'];
#14
+
 /home/zd3tptgsk5kc/public_html/surigraphics/index.php(17): CApplication->run()
12 defined('YII_DEBUG') or define('YII_DEBUG',true);
13 // specify how many levels of call stack should be shown in each log message
14 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
15 ini_set('error_reporting' , 'E_ALL & ~E_NOTICE');
16 require_once($yii);
17 Yii::createWebApplication($config)->run();
18 Yii::app()->setTimeZone('Asia/Kolkata');
19 $app->run();
2024-03-28 19:16:55 Apache Yii Framework/1.1.23-dev