/** *Function to return all the inventory in the database */ function getEquipments() { include "inventory.php"; $eqp = new Inventory(); $row = $eqp->viewInventory(); if (!$row) { echo '{"result": 0, "message": "You have no Equipment in the database"}'; return; } echo '{"result": 1, "equipment": ['; while ($row) { echo json_encode($row); $row = $eqp->fetch(); if ($row) { echo ','; } } echo "]}"; return; }