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 MySQL server version for the right syntax to use near '' at line 1. The SQL statement executed was: UPDATE api_br_catalog_hits SET hits=hits+1 WHERE `date`="202403" and id_catalog=

/local/www/club.orsk.ru/yii/db/CDbCommand.php(354)

342             return $n;
343         }
344         catch(Exception $e)
345         {
346             if($this->_connection->enableProfiling)
347                 Yii::endProfile('system.db.CDbCommand.execute('.$this->getText().')','system.db.CDbCommand.execute');
348             $errorInfo = $e instanceof PDOException ? $e->errorInfo : null;
349             $message = $e->getMessage();
350             Yii::log(Yii::t('yii','CDbCommand::execute() failed: {error}. The SQL statement executed was: {sql}.',
351                 array('{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
352             if(YII_DEBUG)
353                 $message .= '. The SQL statement executed was: '.$this->getText().$par;
354             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
355                 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
356         }
357     }
358 
359     /**
360      * Executes the SQL statement and returns query result.
361      * This method is for executing an SQL query that returns result set.
362      * @param array $params input parameters (name=>value) for the SQL execution. This is an alternative
363      * to {@link bindParam} and {@link bindValue}. If you have multiple input parameters, passing
364      * them in this way can improve the performance. Note that if you pass parameters in this way,
365      * you cannot bind parameters or values using {@link bindParam} or {@link bindValue}, and vice versa.
366      * binding methods and  the input parameters this way can improve the performance.

Stack Trace

#0
+
 /local/www/club.orsk.ru/protected/modules/buildingRepair/controllers/CatalogController.php(37): CDbCommand->execute()
32             Yii::app()->db->createCommand('insert into {{br_catalog_hits}} (`id_catalog`, date) values (' . $id . ', "' . $d . '") ')->execute();
33             $hitss = 1;
34         } else {
35             $hitss = $ch->hits + 1;
36         }
37         Yii::app()->db->createCommand('UPDATE {{br_catalog_hits}} SET hits=hits+1 WHERE `date`="' . $d . '" and id_catalog=' . $model->id)->execute();
38 //        echo '<div style="display: none">'. $_SERVER['DOCUMENT_ROOT'].'</div>';
39         /*$fp1 = fopen($_SERVER['DOCUMENT_ROOT'] . "/uploads/logsRB/log.txt", "a");
40         $arr1 = array('id' => $id, 'date' => date('d.m.Y', time()), 'hits' => $hitss);
41         $test = fwrite($fp1, json_encode($arr1) . ';');
42         fclose($fp1);*/
#10
+
 /local/www/club.orsk.ru/index.php(24): CApplication->run()
19 define('YII_DEBUG',true);
20 // specify how many levels of call stack should be shown in each log message
21 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
22 require_once 'Mobile_Detect.php'; 
23 require_once($yii);
24 Yii::createWebApplication($config)->run();
2024-03-28 17:06:18 nginx/1.10.3 Yii Framework/1.1.10