= 55000 THEN 'General' END as current_rank, po.current_pvp_kills as kills_for_week, po.lifetime_gcw_points as lifetime_gcw_points, po.lifetime_pvp_kills as lifetime_pvp_kills, CASE WHEN po.max_gcw_imperial_rating < 0 THEN 'Not Ranked' WHEN po.max_gcw_imperial_rating < 5000 THEN 'Private' WHEN po.max_gcw_imperial_rating < 10000 THEN 'Lance Corporal' WHEN po.max_gcw_imperial_rating < 15000 THEN 'Corporal' WHEN po.max_gcw_imperial_rating < 20000 THEN 'Sergeant' WHEN po.max_gcw_imperial_rating < 25000 THEN 'Master Sergeant' WHEN po.max_gcw_imperial_rating < 30000 THEN 'Sergeant Major' WHEN po.max_gcw_imperial_rating < 35000 THEN 'Lieutenant' WHEN po.max_gcw_imperial_rating < 40000 THEN 'Captain' WHEN po.max_gcw_imperial_rating < 45000 THEN 'Major' WHEN po.max_gcw_imperial_rating < 50000 THEN 'Lt. Colonel' WHEN po.max_gcw_imperial_rating < 55000 THEN 'Colonel' WHEN po.max_gcw_imperial_rating >= 55000 THEN 'General' END as highest_imperial_rank, CASE WHEN po.max_gcw_rebel_rating < 0 THEN 'Not Ranked' WHEN po.max_gcw_rebel_rating < 5000 THEN 'Private' WHEN po.max_gcw_rebel_rating < 10000 THEN 'Trooper' WHEN po.max_gcw_rebel_rating < 15000 THEN 'High Trooper' WHEN po.max_gcw_rebel_rating < 20000 THEN 'Sergeant' WHEN po.max_gcw_rebel_rating < 25000 THEN 'Senior Sergeant' WHEN po.max_gcw_rebel_rating < 30000 THEN 'Sergeant Major' WHEN po.max_gcw_rebel_rating < 35000 THEN 'Lieutenant' WHEN po.max_gcw_rebel_rating < 40000 THEN 'Captain' WHEN po.max_gcw_rebel_rating < 45000 THEN 'Major' WHEN po.max_gcw_rebel_rating < 50000 THEN 'Commander' WHEN po.max_gcw_rebel_rating < 55000 THEN 'Colonel' WHEN po.max_gcw_rebel_rating >= 55000 THEN 'General' END as highest_rebel_rank from player_objects po join objects o ON (o.object_id = po.object_id) join players p ON (o.contained_by = p.character_object) join tangible_objects tano ON (tano.object_id = p.character_object) where po.current_gcw_points > 0 or po.current_pvp_kills > 0"; $stmt = $conn->query($query); $json = array(); while($details = $stmt->fetch(PDO::FETCH_ASSOC)){ $json[] = $details; } array_walk_recursive($json, function (&$item, $key) { $item = null === $item ? '' : $item; }); echo json_encode($json, JSON_NUMERIC_CHECK); } catch(PDOException $e){ echo ($e->getMessage()); } ?>