function get_player_stats ($user_id) { global $db; $sql .= 'SELECT * FROM beta_character_stats '; if ( $user_stats['user_status'] == '2' && $user_stats['user_located'] == '2' ) { $sql .= 'LEFT JOIN beta_jail USING (user_id) '; } else if ( $user_stats['user_status'] == '3' && $user_stats['user_located'] == '3' ) { $sql .= 'LEFT JOIN beta_hospital USING (user_id) '; } $sql .= "WHERE user_id = '" . $user_id . "'"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'ERROR: Unable to retrieve player statistics.'); } $user_stats = $db->sql_fetchrow($result); return $user_stats; }