<?php
$conn = $mysqli;
// SQL query to select all data from the table
$sql = "SELECT * FROM structure_ranks";
// Fetch all rows from the result set and store them in the array
$result = $conn->query($sql)->fetch_all(MYSQLI_ASSOC);
// Output the array as JSON
echo json_encode($array, JSON_PRETTY_PRINT);