本文整理汇总了PHP中DBAccess::QueryRowAssoc方法的典型用法代码示例。如果您正苦于以下问题:PHP DBAccess::QueryRowAssoc方法的具体用法?PHP DBAccess::QueryRowAssoc怎么用?PHP DBAccess::QueryRowAssoc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBAccess
的用法示例。
在下文中一共展示了DBAccess::QueryRowAssoc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_player_info
/**
* Returns the state of the player from the database,
* uses a user_id if one is present, otherwise
* defaults to the currently logged in player, but can act on any player
* if another username is passed in.
* @param $user user_id or username
* @param @password Unless true, wipe the password.
**/
function get_player_info($user = null, $password = false)
{
$sql = new DBAccess();
$player_data = null;
if (is_numeric($user)) {
$sel_player = "select * from players where player_id = '" . $user . "' limit 1";
} else {
$username = either($user, SESSION::is_set('username') ? SESSION::get('username') : null);
// Default to current session user.
$sel_player = "select * from players where uname = '" . sql($username) . "' limit 1";
}
$player_data = $sql->QueryRowAssoc($sel_player);
if (!$password) {
unset($player_data['pname']);
}
return $player_data;
}