1

I am new for codeigniter,i create a custom helper for user login, in directory app/helper/login_helper.php,below is my code


    function get_user_details($user_id){
       //get main CodeIgniter object
       $ci =& get_instance();

       //load databse library
       $ci->load->database();

       //get data from database
       $query = $ci->db->get_where('users',array('id'=>$id));

       if($query->num_rows() > 0){
           $result = $query->row_array();
           return $result;
       }else{
           return false;
       }
   }

and i load this helper in my controller

$this->load->helper('custom');
$user_details = get_user_details(1);

this helper code is working fine, but i create same code to custom library for user login is also working good,there is no error, and my doubt is then why codeigniter split helper and library? what is the main difference between helper and library? i create login code with helper and library both will give same result? then what is the diference between helper and library?

Madhawa Priyashantha
  • 9,633
  • 7
  • 33
  • 60
Thiyagu
  • 31
  • 11
  • http://stackoverflow.com/questions/2361370/codeigniter-decision-making-for-creating-of-library-helper-in-codeigniter, also – Bert Persyn Oct 17 '16 at 11:49

0 Answers0