2 ) { if( $this->byID( $category['parent'] ) == false ) { $category['parent'] = 0; } } //lets check if its a child or not if( $category['child'] == 0 ) { $category['parent'] = 0; } //save the data $this->db->insert("category",$category); } /** * Category By ID * * Gets category from database, returns true if category exists * return boolean */ function byID( $id ) { $query = $this->db->get_where("category",array('id' => $id)); if( $query->num_rows() == 0 ) return false; return true; } } /* END OF FILE */