function matchList() { if (!isset($_SESSION['username']) || !isset($_SESSION['admin_password'])) { header("index.html"); } include "../../model/matchgallery.php"; $matchgallery = new Matchgallery(); $row = $matchgallery->listGallery(); if (!$row) { echo '{"result": 0, "message": "No match galleries were found"}'; return; } echo '{"result": 1, "matchlist":['; while ($row) { echo json_encode($row); $row = $matchgallery->fetch(); if ($row) { echo ","; } } echo "]}"; return; }
function MatchGallery() { include_once "../model/matchgallery.php"; $gallery = new Matchgallery(); $row = $gallery->getGalleries(); if (!$row) { echo '{"result": 0, "message": "No Match gallery yet"}'; return; } echo '{"result": 1, "galleries": ['; while ($row) { echo json_encode($row); $row = $gallery->fetch(); if ($row) { echo ","; } } echo "]}"; return; }