I am trying to use the following to use database via a function. This is not working as expected. This works outside of the function but not in. The page returns blank when the PDO line is used.
function db($inputStatement){
$link = new PDO("mysql:host=$dbhost;dbname=$dbname",$dbuser,$dbpass);
$statement = $link->prepare($inputStatement);
echo $inputStatement.'-XX';
}
db("SELECT * FROM users");
echo "<br />END OF test.php";