I have a function that is supposed to give me a staff members name from his ID number so my php is like this
$staffId = $_GET['staff_id'];
$staff = staff_load($staffId);
and my function is like this
function staff_load()
{
$dbh = dbh_get(); //connects to database
$sql = 'select user_name from user_staff where user_id = ?';
$stmt = $dbh->prepare($sql);
$stmt->execute();
$staff = $stmt->fetch();
dbh_free($dbh); //disconnects from database
return $staff;
}
But when I try and use the $staff variable, it shows nothing. I can't work out what I'm doing wrong. I've tried a bunch of variants and gotten nowhere except frustrated.
<td>Book for ' . $staff . '</td>