$GLOBALS[‘value1’] is not working

The correct syntax for using with global keyword. To access a global variable in WordPress, you first need to globalize the variable with global $variable;

Write inside function.php as:

    function myfunction(){
       global $get_variable;
       $get_value = $db->query("SELECT * FROM mytable")->fetch();
       $get_variable = $get_value; 
    }

add_action( 'after_theme_setup', 'myfunction' );

Inside the function you can now able to any where. But, outside of this scope it needs to be re-declared as a global scope variable. Ex., to use inside single.php file, it will work as

global $get_variable;
echo $get_variable;

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)