TDbException

Description

TDbCommand failed to execute the query SQL "SELECT i.*, id.name as id_name, id.simple_name as id_simple_name, id.header as id_header, id.meta_description as id_meta_description, id.meta_keywords as id_meta_keywords, id.item as id_item, id.entries as id_entries, id.comments as id_comments, id.all_entries as id_all_entries, id.avatar as id_avatar, ptp.photo as ptp_photo, ptp.item as ptp_item, ptp.priority as ptp_priority, p.src as p_src, par.header as par_header, p.type as p_type, par.content as par_content FROM items i LEFT JOIN items_details id ON id.item = i.id LEFT JOIN photo_to_page ptp ON ptp.item = i.id LEFT JOIN photos p ON ptp.photo = p.id LEFT JOIN paragraphs par ON par.item = i.id WHERE add_date < UNIX_TIMESTAMP() AND i.news= GROUP BY id ORDER BY `add_date` DESC, `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 'GROUP BY id ORDER BY `add_date` DESC, `id` DESC' at line 14

Source File

/var/www/imagestars.pl/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 /var/www/imagestars.pl/framework/Data/DataGateway/TDataGatewayCommand.php(304): TDbCommand->query()
#1 /var/www/imagestars.pl/framework/Data/ActiveRecord/TActiveRecordGateway.php(247): TDataGatewayCommand->findAllBySql(Object(TActiveRecordCriteria))
#2 /var/www/imagestars.pl/framework/Data/ActiveRecord/TActiveRecord.php(678): TActiveRecordGateway->findRecordsBySql(Object(ItemsRecord), Object(TActiveRecordCriteria))
#3 /var/www/imagestars.pl/protected/Pages/Main.php(93): TActiveRecord->findAllBySql('SELECT i.*, \n\t\t...')
#4 /var/www/imagestars.pl/protected/Pages/Main.php(39): Main->refreshLatestArticle()
#5 /var/www/imagestars.pl/protected/Pages/Main.php(19): Main->refreshPage()
#6 /var/www/imagestars.pl/framework/Web/UI/TControl.php(1270): Main->onInit(NULL)
#7 /var/www/imagestars.pl/framework/Web/UI/TCompositeControl.php(35): TControl->initRecursive(NULL)
#8 /var/www/imagestars.pl/framework/Web/UI/TTemplateControl.php(240): TCompositeControl->initRecursive(NULL)
#9 /var/www/imagestars.pl/framework/Web/UI/TPage.php(207): TTemplateControl->initRecursive()
#10 /var/www/imagestars.pl/framework/Web/UI/TPage.php(198): TPage->processNormalRequest(Object(THtmlWriter))
#11 /var/www/imagestars.pl/framework/Web/Services/TPageService.php(498): TPage->run(Object(THtmlWriter))
#12 /var/www/imagestars.pl/framework/Web/Services/TPageService.php(444): TPageService->runPage(Object(Main), Array)
#13 /var/www/imagestars.pl/framework/TApplication.php(1095): TPageService->run()
#14 /var/www/imagestars.pl/framework/TApplication.php(382): TApplication->runService()
#15 /var/www/imagestars.pl/index.php(31): TApplication->run()
#16 {main}
2019-04-20 16:25 Apache/2.2.22 (Debian) PRADO/3.1.7