I have this code
on a functions.php page which is an include on my inc.header page (so every page has the functions). If i call that function at the start of a page and try echo $userDetails['username']; it doesnt return anything but if in the function i put that it outputs the username.
What am i doing wrong? Or is this undoable.
Thanks
PHP Code:
function getUserDetails($ID)
{
$Sql = "SELECT * FROM members WHERE user_id = '$ID'";
$Res = mysql_query($Sql);
while ($row = mysql_fetch_array($Res))
{
foreach ($row as $ide => $val)
{
$userDetails[$ide] = $val;
}
}
return $userDetails;
}
What am i doing wrong? Or is this undoable.
Thanks
Comment