Welcome Guest, Not a member yet? Register   Sign In
Fetching related tables
#6

[eluser]InsiteFX[/eluser]
Here is my code, may work for you
Code:
// --------------------------------------------------------------------

    /**
     * get_all_posts_by_category
     *
     * Description:
     *
     * @access    public
         * @param       string - $category_id
     * @return    array
     */
    public function get_all_posts_by_category($category_id)
    {
        $data = array();

        $this->db->where("category_id", $category_id);
        $this->db->where('status', 'published');

        $query = $this->db->get('posts');

        if ($query->num_rows() > 0)
        {
            foreach ($query->result_array() as $row)
            {
                $data[] = $row;
            }
        }

        $query->free_result();

        return $data;
    }

InsitefX


Messages In This Thread
Fetching related tables - by El Forum - 02-18-2011, 04:24 PM
Fetching related tables - by El Forum - 02-18-2011, 05:11 PM
Fetching related tables - by El Forum - 02-19-2011, 06:11 AM
Fetching related tables - by El Forum - 02-20-2011, 02:31 PM
Fetching related tables - by El Forum - 02-20-2011, 04:43 PM
Fetching related tables - by El Forum - 02-20-2011, 07:23 PM



Theme © iAndrew 2016 - Forum software by © MyBB