这是我的功能
function GetUser($id)
{
global $pdo;
$stmt = $pdo->prepare('SELECT lname,fname,mi FROM user WHERE id = :id LIMIT 1');
$stmt->execute(array(':id'=>$id));
foreach($stmt as $name){
$lname = $name['lname'];
$lname = $name['fname'];
$mi = $name['mi'];
}
return //what to put here?
}
这是我使用该功能的代码
include 'function.php';
$names = GetUser($_SESSION['id']);
//what's next?
如何从函数中检索 $lname、$fname 和 $mi?需要任何帮助和建议。谢谢 :)