Exemple #1
0
/**
*Function to return all the Labs in the database
*/
function getLabs()
{
    include "lab.php";
    $myLab = new Lab();
    $row = $myLab->viewLabs();
    if (!$row) {
        echo '{"result": 0, "message": "You have no Labs in the database"}';
        return;
    }
    echo '{"result": 1, "lab": [';
    while ($row) {
        echo json_encode($row);
        $row = $myLab->fetch();
        if ($row) {
            echo ',';
        }
    }
    echo "]}";
    return;
}