[Typo3-dev] mysql two table select...

Gabriel Anast gabriel at anast.org
Tue Feb 3 17:04:10 CET 2004



This is probably a mysql or PHP question, but I'll try here first... I am
modifying a php file to make the select that I need, and it is a two table
SELECT in which I use a column from each table that has the same name:

$query = "SELECT tt_news.title,tt_news.short, " .
      "tt_news_cat.tx_spnewscatimgs_image,tt_news_cat.title " .
    "FROM tt_news, tt_news_cat " .
    "WHERE tt_news.category = tt_news_cat.uid " .
    "AND tt_news.pid=" .$datapid .
    $this->cObj->enableFields("tt_news") .
    $requiredparams .
    " ORDER BY tt_news.uid LIMIT " .$row .",1";

notice that two columns are being selected that are named "title", one from
tt_news, and one from tt_news_cat. The end result is that in $content both
fields that come from the columns named "title" are filled with the value that
comes from the second table.

Why is this, and is there some way I can modify the SQL or the PHP to specify
the fileds that I want filled with the SELECT?

--gabe




----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.






More information about the TYPO3-dev mailing list