Welcome Guest, Not a member yet? Register   Sign In
Query Problems - Should be a Simple Fix
#1

[eluser]Gwarrior[/eluser]
For some reason, I keep getting an error


A Database Error Occurred

Error Number: 1054

Unknown column 'allengingrich' in 'where clause'

SELECT password FROM users WHERE username=allengingrich

Which is a result of trying to use a login form using the following controller:

Code:
function login() {
         $this->load->database();
        $this->load->library('session');
        if (isset($_POST['submitted'])) {
        $username = $_POST['username'];
        $password = $this->db->query('SELECT password FROM users WHERE username='.$username);
        if ($password->result() == $_POST['password']) {
            $sessdata = array(
            'username' => $_POST['username'],
            );
            $this->session->set_userdata($sessdata);
            redirect('home/success');
        } else {
            redirect('home/failure');
        }
        }
        $this->load->view('login');
    }

Anyone know what gives? I can't figure out what the problem is at all...


Messages In This Thread
Query Problems - Should be a Simple Fix - by El Forum - 10-19-2008, 11:48 AM
Query Problems - Should be a Simple Fix - by El Forum - 10-19-2008, 12:27 PM
Query Problems - Should be a Simple Fix - by El Forum - 10-19-2008, 03:06 PM
Query Problems - Should be a Simple Fix - by El Forum - 10-19-2008, 06:52 PM



Theme © iAndrew 2016 - Forum software by © MyBB