globally get any field value in user table of logged in user

Posted by Jugga on Stack Overflow See other posts from Stack Overflow or by Jugga
Published on 2010-04-12T22:42:46Z Indexed on 2010/04/12 22:52 UTC
Read the original article Hit count: 183

Filed under:
|
|

Im making a gaming community and i wanna be able to grab any info of the user on any page without so instead of having much of queries on all pages i made this function. Is it better to do this? Will this slow down the site?

/**
* ??????? ???????? ?? ????? ??????? authed ?????????????.
*/
function UserData($f)
{
    global $_SESSION;


    return mysql_result(mysql_query("SELECT `$f` FROM `users` WHERE `id` = ".intval($_SESSION['id'])), 0, $f);
}

© Stack Overflow or respective owner

Related posts about best-practices

Related posts about php