Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP Codeigniter-将posts表连接到TOXI标记数据库存储系统_Php_Codeigniter_Activerecord_Tags - Fatal编程技术网

PHP Codeigniter-将posts表连接到TOXI标记数据库存储系统

PHP Codeigniter-将posts表连接到TOXI标记数据库存储系统,php,codeigniter,activerecord,tags,Php,Codeigniter,Activerecord,Tags,我的模型中的功能如下: function get_all_posts($where='') { $this->load->database(); $this->db->select('blog.title,blog.permalink,blog.content,blog.author,blog.date,COUNT(comments.ID) as commentcount'); $this->db->from('blog');

我的模型中的功能如下:

    function get_all_posts($where='')
{
    $this->load->database();
    $this->db->select('blog.title,blog.permalink,blog.content,blog.author,blog.date,COUNT(comments.ID) as commentcount');
    $this->db->from('blog');

    if($where!=''){
    $this->db->where($where);
    }

    $this->db->order_by("blog.ID", "desc");
    $this->db->join('comments', 'blog.ID = comments.postID','left');
    $this->db->group_by('blog.ID');
    $query=$this->db->get();

    $data=$query->result_array();

    return $data;


}
我还有两张桌子-

post_标签:tagID posted 标记:标记ID名称

我一直在玩弄连接,试图获得它,以便与我的所有帖子等一起,返回的变量包含应用于上述帖子的所有标签

我什么都试过了,但几乎没有成功

有人能给点建议吗?
谢谢

您没有正确使用$where

在本例中,$where应该是以下形式的数组:

$where = array(
    "field_name" => "match_value",
    ....more conditions.......
);
因此,请确保$where是数组而不是字符串