Site icon Hip-Hop Website Design and Development

$GLOBALS[‘value1’] is not working

My custom PHP script works on my PC over localhost. But, when I upload my code to the ‘live’ WordPress site, The $GLOBALS values are just null even they work on my localhost. (Nothing wrong with the database connection). Is the $GLOBALS not working on WordPress? My code is something like this one below:

$get_value = $db->query("SELECT * FROM mytable")->fetch();
$get_variable = $get_value['myvalue'];
function myfunction(){
   return $GLOBALS['get_variable']; 
}