Error Info: Array ( [0] => 42000 [1] => 1064 [2] => 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 )
in /local/www/board.orsk.ru/vendor/yiisoft/yii2/db/Command.php at line 822
$exceptionClass = '\yii\db\Exception'; foreach ($this->exceptionMap as $error => $class) { if (strpos($e->getMessage(), $error) !== false) { $exceptionClass = $class; } } $message = $e->getMessage() . "\nThe SQL being executed was: $rawSql"; $errorInfo = $e instanceof \PDOException ? $e->errorInfo : null; return new $exceptionClass($message, $errorInfo, (int) $e->getCode(), $e); } /** * Returns a value indicating whether a SQL statement is for read purpose. * @param string $sql the SQL statement * @return boolean whether a SQL statement is for read purpose. */ public function isReadQuery($sql) {
$this->pdoStatement->closeCursor(); } Yii::endProfile($token, 'yii\db\Command::query'); } catch (\Exception $e) { Yii::endProfile($token, 'yii\db\Command::query'); throw $this->db->getSchema()->convertException($e, $rawSql); } if (isset($cache, $cacheKey, $info)) { $cache->set($cacheKey, [$result], $info[1], $info[2]); Yii::trace('Saved query result in cache', 'yii\db\Command::query'); }
* @return string|null|boolean the value of the first column in the first row of the query result. * False is returned if there is no value. * @throws Exception execution failed */ public function queryScalar() { $result = $this->queryInternal('fetchColumn', 0); if (is_resource($result) && get_resource_type($result) === 'stream') { return stream_get_contents($result); } else { return $result; } }
)->queryColumn(); $query_category=' AND user_id IN ('.implode(',',$users_partner).') '; } $data=[]; $data['pages'] = new Pagination([ 'totalCount' => \Yii::$app->getDb()->createCommand('SELECT count(id) FROM '.self::tableName().' WHERE sys_domain='.\Yii::$app->params['domain_id'].' AND active=1 AND shop=1 '.$query_category)->queryScalar(), 'pageSize' => 10 ]); $data['shops']=Yii::$app->getDb()->createCommand( 'SELECT a.*, (select count(id) from b_board_ads WHERE sys_user_id=a.user_id AND moder_state=1 AND ads_ispartner=1 AND sys_domain='.\Yii::$app->params['domain_id'].' ) as countAds ' .'FROM '.self::tableName().' a ' .'WHERE a.sys_domain='.\Yii::$app->params['domain_id'].' AND a.active=1 AND a.shop=1 '.$query_category
{ public function actionIndex() { $category_id=(int)\Yii::$app->request->get('category_id',0); return $this->render('index',[ 'category_id'=>$category_id, 'data'=>BoardPartner::getShops($category_id) ]); } public function actionView($id){ $category_id=(int)\Yii::$app->request->get('category_id',0); $shop=BoardPartner::getShop($id);