How to inactive the category and subcategory with codeigniter?
Answers
"The code that can be used in the codeigniter is,
public function get_categories() {
$data = array();
$this->db->select('*');
$this->db->from($this->db->dbprefix . 'category');
$query = $this->db->get();
if ($query->num_rows() > 0) {
foreach ($query->result_array() as $result) {
$data[] = array(
'category_id' => $result['category_id'],
'parent_category_id' => $result['parent_category_id'],
'name' => $result['name'],
'url' => $result['url'],
'status' => $result['status'],
'date_added' => $result['date_added'],
'category_delete' => anchor('admin/category/delete/' . $result['category_id'], 'Delete', array('class' => 'btn btn-danger btn-block')),
'category_edit' => anchor('admin/category/update/' . $result['category_id'], 'Edit', array('class' => 'btn btn-primary btn-block'))
);
}
} else {
return false;
}
return $data;
}
"