Fetching information from the database MYSQL & Codeigniter

后端 未结 2 1993
Happy的楠姐
Happy的楠姐 2021-01-26 11:55

the previous question is here incase you guys needed a other information:

Fetching information from the database

ANOTHER UPDATE

Although

2条回答
  •  悲&欢浪女
    2021-01-26 12:40

    This can be very simple read the user guide for more simple examples

    Model
    
    Class Members Extends CI_Model
    {
        function __construct(){
            parent::__construct();
        }
    
        function member_here()
        {
                $this->db->where('username',$this->input->post('username'));
            $query  =   $this->db->get('membership');
    
            if($query->num_rows() > 0) 
            {
                return $query->result();
            }
        }
    }
    
    Controlelr 
    
    Class Login extends CI_Controller
    {
        function __construct()
        {
            parent::__construct();
        }
    
        public function index()
        {
            $this->load->view('login_view');
        }
    
        public function result()
        {
            $this->load->model('membership');
            $data['member'] = $this->membership->member_here(); 
            $this->load->view('result_view', $data);
        }
    }
    
    And in View you can simple do it
    
    
    
    
    

提交回复
热议问题