[Typo3-dev] Newbie:Getting value from another table

Franz Holzinger franz at fholzinger.com
Sat Jun 11 09:58:53 CEST 2005


Hello Georg,

>  function pi_list_row($c) {
>   $query='SELECT * FROM tx_rgzitate_autor, tx_rgzitate_zitat '.' where
> tx_rgzitate_zitat.autorz = tx_rgzitate_autor.uid'.' AND hidden=0 AND
> deleted=0 ';
>   $res = $GLOBALS['TYPO3_DB']->sql(TYPO3_db, $query);
> 
>   return '<tr'.($c%2 ? $this->pi_classParam("listrow-odd") : "").'>
>     <td valign="top"><p>'.$this->getFieldContent("autor").'</p></td>
>    </tr>';
>  }
> 
> I do get results for all the columns of tx_rgzitate_zitat but I don't get a
> result for "autor" :(
> The query is 100% correct.

if you want to use DBAL, you should use this function for connecting 2 
database tables:

function 
exec_SELECT_mm_query($select,$local_table,$mm_table,$foreign_table,$whereClause='',$groupBy='',$orderBy='',$limit='')


Franz




More information about the TYPO3-dev mailing list