Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
SQL Error (Using Query Builder)
  • Hello, I'm wondering if someone could point me to where I went wrong with this. From Model_Auth -
    public static function login()
        {
            $email = Input::post('email');
            $password = sha1(Input::post('password')); // Get SHA1 Password
    
            $query = DB::select('id','username','email','group_id')
            ->from('users')
            ->where_open()
            ->where('email', $email)
            ->and_where('password', $password)
            ->where_close()
            ->limit(1)
            ->execute()
            ->as_array();
    
            if(count($query) > 0) return $query;
    
            return FALSE;
        }
    

    Is returning the following error: Fuel\Core\Database_Exception [ 1064 ]: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL AND `password` DA39A3EE5E6B4B0D3255BFEF95601890AFD80709 NULL) LIMIT 1' at line 1 [ SELECT `id`, `username`, `email`, `group_id` FROM `ss_users` WHERE (`email` NULL AND `password` DA39A3EE5E6B4B0D3255BFEF95601890AFD80709 NULL) LIMIT 1 ] Thanks for any input. I might of missed somthing small, not sure. EDIT: This function is called with a form being submitted to that action with a valid email address and the correct password. I have checked this several times, also print_r'd the post array and the values are there.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!