I wanna be able to get everything from a signed in user. Like, username, email, msn, and alto more with a function like:
echo getUserInfo('email');
gets the content of "email". but it does not work, see below:
My function:
function getUserInf开发者_JAVA技巧o($field) {
global $userID;
$sql = mysql_query("select * from users where id = $userID");
mysql_result($sql, 0, "$field");
return $field;
}
Does not work, it outputs whatever i put in the function when i call it
edit fixed it:
$userID = 1;
function getUserInfo($field) {
global $userID;
$sql = mysql_query("select * from users where id = $userID");
$pop = mysql_result($sql, 0, "$field");
return $pop;
}
精彩评论