Unable to connect to database in prepared statement
I can't seem to get this to connect to the database so that I can run my prepared statement. Does anybody have an idea what I've forgotten?

    private function check_credentials($plain_username, $password)
        {
        global $dbcon;
    
        $ac = new ac();
        $ac->dbconnect();
        $userid = $dbcon->prepare('SELECT id FROM users WHERE username = :username AND password = :password LIMIT 1');
        $userid->bindParam(':username', $plain_username);
        $userid->bindParam(':password', $password);
        $userid->execute();
    
        $id = $userid->fetch();
        Return $id;
        }
Unable to connect to database in prepared statement
===

I can't seem to get this to connect to the database so that I can run my prepared statement. Does anybody have an idea what I've forgotten?

    private function check_credentials($plain_username, $password)
        {
        global $dbcon;
    
        $ac = new ac();
        $ac->dbconnect();
        $userid = $dbcon->prepare('SELECT id FROM users WHERE username = :username AND password = :password LIMIT 1');
        $userid->bindParam(':username', $plain_username);
        $userid->bindParam(':password', $password);
        $userid->execute();
    
        $id = $userid->fetch();
        Return $id;
        }