Welcome Guest, Not a member yet? Register   Sign In
search query
#1

[eluser]bigdaddysheikh[/eluser]
Hey,

I search a query to find a matching username and password. Upon false, it should take the user back to the login page. The initial page on load should not return a value for the query because no user information exist. But yet there is a value of 1 being returned by num_row()

Code:
$this->load->model('adminmodel');
        $query = $this->adminmodel->search_query('user', $_POST);
                
        if($query->num_rows() == '1'){
        
        $newdata = array(
                   'username'  => $_POST['username'],
                   'logged_in' => TRUE
               );

        $this->session->set_userdata($newdata);    
        $this->load->view('admin/index');
            
        }else{    
            $data['error'] = "The username or password is incorrect";
            $this->load->view('admin/login', $data);
        }


And the model function that is doing the search is:
Code:
function search_query($table, $data)
    {
        $query = $this->db->get_where($table, $data);
        return $query;
    }

how is it returning the value of 1?


Messages In This Thread
search query - by El Forum - 06-13-2008, 06:59 AM
search query - by El Forum - 06-13-2008, 07:27 AM
search query - by El Forum - 06-13-2008, 07:40 AM
search query - by El Forum - 06-13-2008, 07:42 AM
search query - by El Forum - 06-13-2008, 07:44 AM
search query - by El Forum - 06-13-2008, 07:50 AM
search query - by El Forum - 06-13-2008, 07:57 AM
search query - by El Forum - 06-13-2008, 08:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB