【问题标题】:how to write this query in codeigniter, i send my id to the model, but this query must be writen good in model [closed]如何在codeigniter中编写这个查询,我将我的id发送到模型,但是这个查询必须在模型中写好[关闭]
【发布时间】:2013-09-17 23:30:00
【问题描述】:

我有这个问题:

SELECT hapnin 
FROM test.user_favourites, test.happenings t 
WHERE user_id = $id 
AND  t.id = happening_id 

我想在 codeiniger 模型中重新编写它。请如果有人可以帮助我解决这个问题。

【问题讨论】:

    标签: php mysql codeigniter postgresql


    【解决方案1】:

    您确定您的查询没问题?试试这个希望它有效。

    $this->db->select('hapnin')->from('user_favourites, happenings t')->where("user_id = $id AND t.id = happening_id", false)->get();
    

    【讨论】:

      【解决方案2】:

      试试这个

      $this->db->select('hapnin')
               ->from('user_favourites, happenings t')
               ->where("user_id = $id")
               ->where("t.id = happening_id")
               ->get()
               ->result();  
      

      【讨论】:

        猜你喜欢
        • 2017-11-18
        • 2017-06-13
        • 1970-01-01
        • 2021-08-18
        • 2021-02-06
        • 1970-01-01
        • 2015-10-19
        • 2016-04-23
        • 1970-01-01
        相关资源
        最近更新 更多