Database Exception – yii\db\Exception 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 being executed was: SELECT * FROM `product_media` WHERE (`active`=1) AND (`product_id`=) 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 ) ↵ Caused by: PDOException 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 in /var/www/vhosts/munozylancharro.com/munozylancharro/vendor/yiisoft/yii2/db/Command.php at line 915 1. in /var/www/vhosts/munozylancharro.com/munozylancharro/vendor/yiisoft/yii2/db/Schema.php at line 636 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 $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 bool whether a SQL statement is for read purpose. */ public function isReadQuery($sql) { 2. in /var/www/vhosts/munozylancharro.com/munozylancharro/vendor/yiisoft/yii2/db/Command.php at line 930 – yii\db\Schema::convertException(PDOException, 'SELECT * FROM `product_media` WH...') 3. in /var/www/vhosts/munozylancharro.com/munozylancharro/vendor/yiisoft/yii2/db/Command.php at line 362 – yii\db\Command::queryInternal('fetchAll', null) 4. in /var/www/vhosts/munozylancharro.com/munozylancharro/vendor/yiisoft/yii2/db/Query.php at line 213 – yii\db\Command::queryAll() 5. in /var/www/vhosts/munozylancharro.com/munozylancharro/vendor/yiisoft/yii2/db/ActiveQuery.php at line 135 – yii\db\Query::all(null) 6. in /var/www/vhosts/munozylancharro.com/munozylancharro/modules/catalog/service/ProductMediaService.php at line 47 – yii\db\ActiveQuery::all() 41 42 43 44 45 46 47 48 49 50 $productMediaModel->main = 1; $productMediaModel->save(); return $productMediaModel; } static public function productMediaListByProductID($productId){ $productMediaList = ProductMedia::find()->active()->byProductId($productId)->all(); return $productMediaList; } } 7. in /var/www/vhosts/munozylancharro.com/munozylancharro/landing/controllers/SiteController.php at line 144 – modules\catalog\service\ProductMediaService::productMediaListByProductID(null) 138 139 140 141 142 143 144 145 146 147 148 149 150 $cookieData = \Yii::$app->getRequest()->getCookies()->getValue('comparador'); if (!empty($cookieData) && in_array($productModel->code_number, $cookieData)){ $inComparator = true; } return $this->render('inventory', [ 'model' => $productModel, 'productMediaList' => \modules\catalog\service\ProductMediaService::productMediaListByProductID($productModel->id), 'inComparator' => $inComparator ]); } public function actionCatalog() { 8. landing\controllers\SiteController::actionInventory('nissan-atleon-1206') 9. in /var/www/vhosts/munozylancharro.com/munozylancharro/vendor/yiisoft/yii2/base/InlineAction.php at line 57 – call_user_func_array([landing\controllers\SiteController, 'actionInventory'], ['nissan-atleon-1206']) 10. in /var/www/vhosts/munozylancharro.com/munozylancharro/vendor/yiisoft/yii2/base/Controller.php at line 156 – yii\base\InlineAction::runWithParams(['seo_path' => 'nissan-atleon-1206']) 11. in /var/www/vhosts/munozylancharro.com/munozylancharro/vendor/yiisoft/yii2/base/Module.php at line 523 – yii\base\Controller::runAction('inventory', ['seo_path' => 'nissan-atleon-1206']) 12. in /var/www/vhosts/munozylancharro.com/munozylancharro/vendor/yiisoft/yii2/web/Application.php at line 102 – yii\base\Module::runAction('site/inventory', ['seo_path' => 'nissan-atleon-1206']) 13. in /var/www/vhosts/munozylancharro.com/munozylancharro/vendor/yiisoft/yii2/base/Application.php at line 380 – yii\web\Application::handleRequest(yii\web\Request) 14. in /var/www/vhosts/munozylancharro.com/munozylancharro/landing/web/index.php at line 18 – yii\base\Application::run() 12 13 14 15 16 17 18 require(__DIR__ . '/../../common/config/main-local.php'), require(__DIR__ . '/../config/main.php'), require(__DIR__ . '/../config/main-local.php') ); $application = new yii\web\Application($config); $application->run(); $_GET = [ 'seo_path' => 'nissan-atleon-1206', ]; 2019-05-30, 05:53:45 Apache Yii Framework/2.0.12.2