You have to pass variables into a function, they cannot read variables created outside. So now, function xyz reads the first parameter entered (in this case $abc is sent in the line echo xyz($abc) and uses it as variable $test within the function xyz...
For a start you effectively are duplicating the echo command, once within the fuction and once when calling the function. Secondly you need to declare the variable global within the function.
Code:
<?php
error_reporting(E_ALL);
$abc = 'hello';
function xyz(){
global $abc;
echo $abc;
}
xyz();
?>
globals destroy reusability. Pass you're variable as a parameter to you're function instead.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php