本文整理匯總了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;
}