TDbException

Description

TDbCommand failed to execute the query SQL "SELECT * FROM `photos` WHERE pages_id = ORDER BY `position` ASC": 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 'ORDER BY `position` ASC' at line 1

Source File

/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 /framework/Data/DataGateway/TDataGatewayCommand.php(134): TDbCommand->query()
#1 /framework/Data/ActiveRecord/TActiveRecordGateway.php(225): TDataGatewayCommand->findAll(Object(TActiveRecordCriteria))
#2 /framework/Data/ActiveRecord/TActiveRecord.php(562): TActiveRecordGateway->findRecordsByCriteria(Object(PhotoRecord), Object(TActiveRecordCriteria), true)
#3 /protected/common/BasePage.php(41): TActiveRecord->findAll(Object(TActiveRecordCriteria))
#4 /framework/pradolite.php(6221): BasePage->onPreInit(NULL)
#5 /framework/pradolite.php(6217): TPage->processNormalRequest(Object(THtmlWriter))
#6 /framework/pradolite.php(8342): TPage->run(Object(THtmlWriter))
#7 /framework/pradolite.php(8308): TPageService->runPage(Object(Page), Array)
#8 /framework/pradolite.php(9299): TPageService->run()
#9 /framework/pradolite.php(8901): TApplication->runService()
#10 /index.php(27): TApplication->run()
#11 {main}
2023-06-05 09:49 IdeaWebServer/5.2.0 (like Apache) PRADO/3.1.10