connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
// Some Examples
// List last 5 missions at the server
echo "
List last 5 missions at the server
";
if ($result = $mysqli->query("SELECT * FROM `pe_DataMissionHashes` ORDER BY `pe_DataMissionHashes`.`pe_DataMissionHashes_datetime` DESC LIMIT 5")) {
echo "
";
while($row = mysqli_fetch_array($result))
{
echo "";
echo "| " . $row['pe_DataMissionHashes_id'] . " | ";
echo "" . $row['pe_DataMissionHashes_hash'] . " | ";
echo "" . $row['pe_DataMissionHashes_datetime'] . " | ";
echo "
";
}
echo "
";
$result->close();
}
// List last 5
echo "
List last 5 players known server
";
if ($result = $mysqli->query("SELECT * FROM `pe_DataPlayers` ORDER BY `pe_DataPlayers`.`pe_DataPlayers_updated` DESC LIMIT 5")) {
echo "
";
while($row = mysqli_fetch_array($result))
{
echo "";
echo "| " . $row['pe_DataPlayers_id'] . " | ";
echo "" . $row['pe_DataPlayers_ucid'] . " | ";
echo "" . $row['pe_DataPlayers_lastname'] . " | ";
echo "" . $row['pe_DataPlayers_updated'] . " | ";
echo "
";
}
echo "
";
$result->close();
}
// List last 5 chat messages
echo "
List last 5 chat messages (note: INNER JOIN is used to pull the player's name from other table)
";
if ($result = $mysqli->query("SELECT * FROM `pe_LogChat` INNER JOIN `pe_DataPlayers` on `pe_LogChat`.pe_LogChat_playerid = `pe_DataPlayers`.pe_DataPlayers_id ORDER BY `pe_LogChat`.`pe_LogChat_datetime` DESC LIMIT 5")) {
echo "
";
while($row = mysqli_fetch_array($result))
{
echo "";
echo "| " . $row['pe_LogChat_datetime'] . " | ";
echo "" . $row['pe_DataPlayers_lastname'] . " | ";
echo "" . $row['pe_LogChat_msg'] . " | ";
echo "
";
}
echo "
";
$result->close();
}
// List last 5 events
echo "
List last 5 events
";
if ($result = $mysqli->query("SELECT * FROM `pe_LogEvent` ORDER BY `pe_LogEvent_datetime` DESC LIMIT 5")) {
echo "
";
while($row = mysqli_fetch_array($result))
{
echo "";
echo "| " . $row['pe_LogEvent_datetime'] . " | ";
echo "" . $row['pe_LogEvent_content'] . " | ";
echo "
";
}
echo "
";
$result->close();
}
// List last statistics
echo "
List last statistics (note: multiple INNER JOINs is used to pull information from other table)
";
if ($result = $mysqli->query("SELECT * FROM `pe_LogStats` INNER JOIN `pe_DataMissionHashes` ON `pe_LogStats`.pe_LogStats_missionhash_id = `pe_DataMissionHashes`.pe_DataMissionHashes_id INNER JOIN `pe_DataPlayers` ON `pe_LogStats`.pe_LogStats_playerid = `pe_DataPlayers`.pe_DataPlayers_id INNER JOIN `pe_DataTypes` ON `pe_LogStats`.pe_LogStats_typeid = `pe_DataTypes`.pe_DataTypes_id ORDER BY pe_LogStats_datetime desc LIMIT 5")) {
echo "
";
while($row = mysqli_fetch_array($result))
{
echo "";
echo "| " . $row['pe_LogStats_datetime'] . " | ";
echo "" . $row['pe_DataPlayers_lastname'] . " | ";
echo "" . $row['pe_DataTypes_name'] . " | ";
echo "" . $row['ps_crashes'] . " | ";
echo "" . $row['ps_kills_planes'] . " | ";
echo "" . $row['ps_kills_armor'] . " | ";
// TIP: See documentation there is many more counted events which can be displayed here
echo "" . $row['pe_LogStats_mstatus'] . " | ";
echo "
";
}
echo "
";
$result->close();
}
// Get JSON objects with actual server information including LotATC and DCS SRS information
echo "
Get JSON objects with actual server information including LotATC and DCS SRS information
";
if ($result = $mysqli->query("SELECT * FROM `pe_DataRaw`")) {
echo "
";
while($row = mysqli_fetch_array($result))
{
echo "";
echo "| " . $row['pe_dataraw_updated'] . " | ";
echo "" . $row['pe_dataraw_payload'] . " | ";
echo "
";
}
echo "
";
$result->close();
}
// Close database connection
$mysqli->close();
?>