TYPO3 MySQL选择查询,适用于phpMyAdmin但不适用于TYPO3

时间:2013-10-31 13:05:41

标签: mysql typo3 typoscript

如果我在phpMyAdmin中为我的数据库运行下面的代码,那么我得到17条记录,但是当我在TYPO3 6.1.4中运行它时我得到DB(200)中的所有记录,为什么它在TYPO3中不能100%工作,当它在phpMyAdmin中工作时。

public function getKategorierne($catId){
        //print $catId;
        $query = $this->createQuery();
        $query->statement('SELECT * '.
                            'FROM sys_category_record_mm '.
                            'INNER JOIN sys_category ON ( uid = uid_local ) '.
                            'WHERE tablenames = "tx_origkentaurproducts_domain_model_design" '.
                            'AND sys_category_record_mm.uid_local '.
                            'IN ('.$catId.') '.
                            'ORDER BY uid_foreign');

        return $query->execute();

    }

1 个答案:

答案 0 :(得分:0)

为什么所有引号都被引用了!?!?

$query = "
SELECT * 
  FROM sys_category_record_mm r
  JOIN sys_category c
    ON uid = uid_local 
 WHERE tablenames = 'tx_origkentaurproducts_domain_model_design' 
   AND r.uid_local IN ('$catId') 
 ORDER 
    BY uid_foreign;
";