Advertisement
Guest User

contoh no 2

a guest
Mar 23rd, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. //controller
  2. $username = $this->input->post("username", TRUE);
  3. $password = MD5($this->input->post('password', TRUE));
  4. //checking data via model
  5. $checking = $this->admin->check_login('tbl_users', array('username' => $username), array('password' => $password));
  6.  
  7.  
  8. //model
  9. function check_login($table, $field1, $field2)
  10. {
  11. $this->db->select('*');
  12. $this->db->from($table);
  13. $this->db->where($field1);
  14. $this->db->where($field2);
  15. $this->db->limit(1);
  16. $query = $this->db->get();
  17. if ($query->num_rows() == 0) {
  18. return FALSE;
  19. } else {
  20. return $query->result();
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement