CDbException

CDbCommand не удалось исполнить SQL-запрос: 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 '' at line 1. The SQL statement executed was: SELECT id, name FROM categories WHERE remote_id=

/home/chudoder/domains/chudoderevo.kiev.ua/public_html/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

#1
+
 /home/chudoder/domains/chudoderevo.kiev.ua/public_html/protected/models/Products.php(160): CDbCommand->queryRow()
155     }
156 
157     public function getByLatinName($name) {
158         $products = Yii::app()->db->createCommand("SELECT * FROM ".$this->tableName()." WHERE latin_name=:l_n ORDER BY `name`")->bindValue(':l_n', $name)->queryAll();
159 
160         $category = Yii::app()->db->createCommand("SELECT id, name FROM categories WHERE remote_id=".$products[0]['category_id'])->queryRow();
161 
162         return array(
163             'dataProvider' => new CArrayDataProvider($products, array(
164                 'id' => 'Products',
165             )),
#2
+
 /home/chudoder/domains/chudoderevo.kiev.ua/public_html/protected/controllers/ShopController.php(156): Products->getByLatinName("Prunus avium 'Vanda'")
151         Yii::app()->clientScript->registerCssFile('/js/fancybox/jquery.fancybox.css');
152         $this->render('shortProductsList', array('products'=>$products, 'currentCategory'=>$currentCategory));
153     }
154 
155     public function actionSearch($name) {
156         $products = Products::model()->getByLatinName($name);
157 
158         if ($products) {
159             $this->breadcrumbs[$products['category']['name']] = array('/shop/category', 'id'=>$products['category']['id']);
160             $this->breadcrumbs[$name] = array('/shop/search', 'name'=>$name);
161             $currentCategory['name'] = $name;
#17
+
 /home/chudoder/domains/chudoderevo.kiev.ua/public_html/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 
16 require_once($yii);
17 Yii::createWebApplication($config)->run();
2024-03-28 14:56:45 Apache/2 Yii Framework/1.1.13