空数组返回有语法错误SELECT(PDO)

时间:2015-07-24 04:16:58

标签: php mysql pdo

每次运行时我都会得到一个空数组,我无法弄清楚问题是什么。我有与SELECT语句匹配的数据但是我从来没有得到它。

$sql = "SELECT `conversation`.`id`, `conversation`.`subject`, MAX(`message`.`date`) AS `last_reply` 
                FROM `conversation`
                LEFT JOIN `message` ON `conversation`.`id` = `message`.`id`
                INNER JOIN `con_users` ON `conversation`.`id` = `con_users`.`user_id`
                WHERE `con_users`.`user_id` = {$user_id}
                AND `con_users`.`deleted` = 0 GROUP BY `conversation`.`id` ORDER BY `last_reply` DESC";
        return $this->_db->runQuery($sql);

这是我的runQuery()

$this->_query = $this->_pdo->prepare($sql);
        if($this->_query->execute()){
            try{
                $this->_results = $this->_query->fetchAll(PDO::FETCH_OBJ);
                return $this->_results;
            }catch(Exception $e){
                // Catch Error
            }
            return true;
        }else{
            return false;
        }

如果有人能告诉我我做错了什么,我们将不胜感激。

由于

0 个答案:

没有答案