• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
details not being pull from databse table user login

Yes, that would appear to be the case
Having a return statement in the middle of a function will cause the function to end at that point

(the reason you're using the return is cause you tried to embed the function TheFuzzyOne gave you into inline code)

Try changing it to an if statement

do you mean somthing like this:
if( $res = $this->db->get_where('members', array('username' => $username, 'password' => $password)))
        return ($res->num_rows() == 1);

Try this
function process_login() {
        $username = $this->input->post("username");
        $password = $this->input->post("password");
        $this->db->where('username', $username);
        $this->db->where('password', $password);
        $query = $this->db->get('members');
        if($query->num_rows() == 1) {
            $data = array('username'=>$username,'logged_in'=>true);
        } else{
                $this->session->set_flashdata('message','<div id="message">you have entered the wrong details</div>');

All I've done, is broken the where and get into seperate clauses (personal preference)
And checked if that returns a single row, if it does, log them in as normal, else, redirect to login


It works perfectly thank you very much this has been bugging me for a few days.

Thanks again

Your welcome Smile
Now all you need to do (if you want to do proper MVC) is move the database stuff to a model

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.