TDbException

Description

TDbCommand failed to execute the query SQL "SELECT c.id, c.name, c.simple_name, c.description, c.semester, s.simple_name AS sem_name FROM category c LEFT JOIN semesters s ON c.semester=s.id WHERE c.semester = ORDER BY `id` DESC": 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 `id` DESC' at line 5

Source File

/alt/home/webmaster.project8/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 /alt/home/webmaster.project8/framework/Data/DataGateway/TDataGatewayCommand.php(303): TDbCommand->query()
#1 /alt/home/webmaster.project8/framework/Data/ActiveRecord/TActiveRecordGateway.php(247): TDataGatewayCommand->findAllBySql(Object(TActiveRecordCriteria))
#2 /alt/home/webmaster.project8/framework/Data/ActiveRecord/TActiveRecord.php(678): TActiveRecordGateway->findRecordsBySql(Object(CategoryRecord), Object(TActiveRecordCriteria))
#3 /alt/home/webmaster.project8/work/wit/protected/Pages/Main.php(72): TActiveRecord->findAllBySql('?SELECT c.id, c...')
#4 /alt/home/webmaster.project8/work/wit/protected/Pages/Main.php(48): Main->categorySorting('robots.txt', 0, '0')
#5 /alt/home/webmaster.project8/framework/Web/UI/TControl.php(1270): Main->onInit(NULL)
#6 /alt/home/webmaster.project8/framework/Web/UI/TCompositeControl.php(35): TControl->initRecursive(NULL)
#7 /alt/home/webmaster.project8/framework/Web/UI/TTemplateControl.php(240): TCompositeControl->initRecursive(NULL)
#8 /alt/home/webmaster.project8/framework/Web/UI/TPage.php(207): TTemplateControl->initRecursive()
#9 /alt/home/webmaster.project8/framework/Web/UI/TPage.php(198): TPage->processNormalRequest(Object(THtmlWriter))
#10 /alt/home/webmaster.project8/framework/Web/Services/TPageService.php(474): TPage->run(Object(THtmlWriter))
#11 /alt/home/webmaster.project8/framework/Web/Services/TPageService.php(420): TPageService->runPage(Object(Main), Array)
#12 /alt/home/webmaster.project8/framework/TApplication.php(1095): TPageService->run()
#13 /alt/home/webmaster.project8/framework/TApplication.php(382): TApplication->runService()
#14 /alt/home/webmaster.project8/work/wit/index.php(31): TApplication->run()
#15 {main}
2010-09-03 12:58 Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8g PHP/5.2.12 mod_auth_pgsql/2.0.3 PRADO/3.1.6