MY CODE STILL REGISTERS A USER WITH THE SAME USERNAME

558fe5180e0e8fc922d31c23ef84d240
                    function username_exists($username){
                        global $db;
                        $sql = "SELECT 'username' FROM users WHERE 'username' = '$username'";
                        $result = mysqli_query($db, $sql);
                        confirmquery( $result );

                         if (mysqli_num_rows($result) > 0) {
                           return true;
                         }else {
                           return false;
                         }
                    }
                    if(username_exists($username)){
                            $error['username'] = 'Username already exists';
                          }

my function is not working

558fe5180e0e8fc922d31c23ef84d240
                        function username_exists($username){
                            global $db;
                            $sql = "SELECT 'username' FROM users WHERE 'username' = '$username'";
                            $result = mysqli_query($db, $sql);
                            confirmquery( $result );

                             if (mysqli_num_rows($result) > 0) {
                               return true;
                             }else {
                               return false;
                             }
                        }
                        if(username_exists($username)){
                                $error['username'] = 'Username already exists';
                              }