prepare(" SELECT uid, area_type, area, stage, time, score, rank FROM record WHERE uid = :uid AND area_type = :area_type AND area = :area; "); $statement->bindValue(':uid', $uid, SQLITE3_INTEGER); $statement->bindValue(':area_type', $area_type, SQLITE3_INTEGER); $statement->bindValue(':area', $area, SQLITE3_INTEGER); $r = $statement->execute()->fetchArray(SQLITE3_ASSOC); if ($r){ $this->uid = $r["uid"]; $this->area = new K_Area($r["area"], $r["area_type"]); $this->stage = $r["stage"]; $this->time = $r["time"]; $this->score = $r["score"]; $this->rank = $r["rank"]; $statement = $db->prepare(" SELECT unit, k_unit, (SELECT count(id) FROM unit WHERE unit.id = record_party.unit) AS owned, leader, front FROM record_party WHERE uid = :uid AND area_type = :area_type AND area = :area ORDER BY front DESC, leader DESC; "); $statement->bindValue(':uid', $uid, SQLITE3_INTEGER); $statement->bindValue(':area_type', $area_type, SQLITE3_INTEGER); $statement->bindValue(':area', $area, SQLITE3_INTEGER); $q = $statement->execute(); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ if ($r["owned"] > 0){ array_push($this->party, new Unit($r["unit"], false)); } else{ array_push($this->party, new K_Unit($r["k_unit"], false)); } if ($r["leader"] == 1){ $this->leader = $r["unit"]; } if ($r["front"] == 1){ array_push($this->frontline, $r["unit"]); } } } } } ?>