[TYPO3-english] MySQL query error

Christian Futterlieb christian at futterlieb.ch
Thu Sep 26 13:31:04 CEST 2013


Hi Thomas

You cannot use php code in typoscript. This is the typoscript equivalent 
to your code below (not tested):

lib.drilllist = CONTENT
lib.drilllist {
     table = Strukturtx_drillings_domain_model_drillcat
     select {
         selectFields = categorytitle
         orderBy = categorytitle ASC
     }

     renderObj = TEXT
     renderObj.field = categorytitle
     renderObj.wrap = |<br />
}

I'd suggest reading some documentation for a better understanding of 
TYPO3, like those:
http://docs.typo3.org/typo3cms/GettingStartedTutorial/Templates/Index.html
http://docs.typo3.org/typo3cms/TyposcriptReference/

Regards, Christian


On 26.09.13 12:10, Thomas Petersen wrote:
> Hi Im new to Typo3.
>
> I need to get some date from a DB, and i have added the tables ex.
>
> I have then under "link"->"Template" made this TS-script "soccerlist".
> lib.drilllist = CONTENT
> lib.drilllist {
> //Select Query
> $res = $GLOBALS['TYPO3_DB']->sql(TYPO3_db, 'SELECT categorytitle FROM
> Strukturtx_drillings_domain_model_drillcat WHERE hidden=0 ORDER BY
> categorytitle ASC');
>
> while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
>
>     echo $row['categorytitle'].'<br />';
>
> }
> }
>
> I have then added the template to the maintemplate under "Include Basis
> Template:"
> And then i have added the following code to my "page"->"frontpage
> <f:cObject typoscriptObjectPath="lib.drilllist" />
>
> when i then run the page i get the "Oops, an error occurred!" i can get
> the error fixed if i deselect the template from the MainTemplate
> "include Basic Template", so i think its the TS query script thats,
> something wrong with.
>
> Can someone help me ?


More information about the TYPO3-english mailing list