Are you a regular stikked user? Signup so you can keep track of your pastes!
  1. function get_all_categories($arr = '', $parent_id = '0', $indent = '  '){
  2.                 if (!is_array($arr)) $arr = array();
  3.                 $this->db->select('category_id, category_name');
  4.                 $this->db->where('parent_id',$parent_id);
  5.                 $this->db->order_by("category_name","ASC");
  6.         $query = $this->db->get('categories');
  7.         foreach ($query->result() as $item){
  8.                 $arr[] = array($item->category_id => $indent . $item->category_name);
  9.                 if ($item->category_id != $parent_id) {
  10.                                 $arr=$this->m_categories->get_all_categories($arr, $item->category_id, '  '.$indent);
  11.                         }
  12.         }
  13.         return $arr;
  14.     }

Reply to "form_dropdown"

Here you can reply to the paste above

Create a snipurl

Make Private

Feeling clever? Set some advanced options.