<?php
$action = '';
if (isset($_GET['action'])) $action = $_GET['action'];
$ID = '';
if (isset($_GET['ID'])) $ID = $_GET['ID'];
$values = '';
if (isset($_GET['values'])) $values = $_GET['values'];
switch ($action)
{
case "SelectAllAnimals":
$sql = ("SELECT * FROM Animals");
break;
case "DeleteOneAnimal":
$sql = ("DELETE FROM Animals WHERE ID = $ID");
break;
case "InsertOneAnimal":
$sql = ("INSERT INTO Animals (ID, type, name, birth_date, sex) VALUES ($ID, $values)");
break;
case "UpdateOneAnimal":
$splittedvalues = explode(", ",$values);
$sql = ("UPDATE Animals SET type = $splittedvalues[0], name = $splittedvalues[1], birth_date = $splittedvalues[2], sex = $splittedvalues[3] WHERE ID = $ID");
break;
}
?>