TDbException

Description

TDbCommand failed to execute the query SQL " Select count(ProductID) from tbl_Product where CategoryID= and ProductCode like '%' and ProductIsActive='Active' AND tbl_Product.IsDeleted = 'No' ": 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 'and ProductCode like '%' and ProductIsActive='Active' AND tbl_Product.IsDeleted ' at line 1

Source File

/home/express/framework/Data/TDbCommand.php (230)

0219:         try
0220:         {
0221:             // Prado::trace('Query: '.$this->getDebugStatementText(), 'System.Data');
0222:             if($this->_statement instanceof PDOStatement)
0223:                 $this->_statement->execute();
0224:             else
0225:                 $this->_statement=$this->getConnection()->getPdoInstance()->query($this->getText());
0226:             return new TDbDataReader($this);
0227:         }
0228:         catch(Exception $e)
0229:         {
0230: throw new TDbException('dbcommand_query_failed',$e->getMessage(),$this->getDebugStatementText());
0231: } 0232: } 0233: 0234: /** 0235: * Executes the SQL statement and returns the first row of the result. 0236: * This is a convenient method of {@link query} when only the first row of data is needed. 0237: * @param boolean whether the row should be returned as an associated array with 0238: * column names as the keys or the array keys are column indexes (0-based). 0239: * @return array the first row of the query result, false if no result. 0240: * @throws TDbException execution failed 0241: */ 0242: public function queryRow($fetchAssociative=true)

Stack Trace

#0 /home/express/framework/Data/SqlMap/Statements/TMappedStatement.php(398): TDbCommand->query()
#1 /home/express/framework/Data/SqlMap/Statements/TMappedStatement.php(378): TMappedStatement->runQueryForObject(Object(TDbConnection), Object(TDbCommand), NULL)
#2 /home/express/framework/Data/SqlMap/TSqlMapGateway.php(73): TMappedStatement->executeQueryForObject(Object(TDbConnection), Array, NULL)
#3 /home/express/public_html/protected/pages/ProductList.php(414): TSqlMapGateway->queryForObject('GetProducts_Cou...', Array)
#4 /home/express/public_html/protected/pages/ProductList.php(134): ProductList->getCount(Array)
#5 /home/express/framework/Web/UI/TControl.php(1286): ProductList->onLoad(NULL)
#6 /home/express/framework/Web/UI/TPage.php(215): TControl->loadRecursive()
#7 /home/express/framework/Web/UI/TPage.php(198): TPage->processNormalRequest(Object(THtmlWriter))
#8 /home/express/framework/Web/Services/TPageService.php(498): TPage->run(Object(THtmlWriter))
#9 /home/express/framework/Web/Services/TPageService.php(444): TPageService->runPage(Object(ProductList), Array)
#10 /home/express/framework/TApplication.php(1095): TPageService->run()
#11 /home/express/framework/TApplication.php(382): TApplication->runService()
#12 /home/express/public_html/index.php(21): TApplication->run()
#13 {main}
2017-10-23 19:15 Apache/2.4.18 (Ubuntu) PRADO/3.1.7