* @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License V3 * @package SWDB */ /** * Deletes a team. * * Reads the POST parameters looking for the following KEYS: * player: the team owner's player id. * id: the team id. * * @return int 201 on success, HTTP error status codes on failure. * @category Action */ function action(){ $player = filter_input(INPUT_POST, 'player'); $id = filter_input(INPUT_POST, 'id'); $statement = get_context()->get_db()->prepare('DELETE FROM team WHERE player = :player AND id = :id;'); $statement->bindValue(':player', $player, SQLITE3_TEXT); $statement->bindValue(':id', $id, SQLITE3_TEXT); $statement->execute(); $statement = get_context()->get_db()->prepare('DELETE FROM team_unit WHERE team = :id;'); $statement->bindValue(':id', $id, SQLITE3_TEXT); $statement->execute(); return 201; }