| Current Path : /home/xbodynamge/crosstraining/reservation/dev/admin/ |
| Current File : /home/xbodynamge/crosstraining/reservation/dev/admin/action_reservation.php |
<?php
include_once('init.inc.php');
if ($_POST['type']=="annuler"){
try {
$transactDB = new PDO("mysql:host=".$DB_server.";dbname=".$DB_dbname, $DB_login, $DB_pass);
$transactDB->beginTransaction();
$transactDB->query("delete from reservation_reservation where id = ".$_POST['id_reservation']);
$transactDB->query("update reservation_client set nb_seance=nb_seance+1 where id = ".$_POST['id_client']);
$transactDB->commit();
} catch (Exception $e) {
$transactDB->rollback();
}
header('Location: page_client.php');
}
if ($_POST['type']=="creer"){
try {
$transactDB = new PDO("mysql:host=".$DB_server.";dbname=".$DB_dbname, $DB_login, $DB_pass);
$transactDB->beginTransaction();
$transactDB->query("insert into reservation_reservation (id_client, id_salle, date, heure_deb, heure_fin, type_seance) value (".$_POST['id_client'].", '".$_POST['id_salle']."', '".$_POST['date']."', '".$_POST['heure_debut']."', '".$_POST['heure_fin']."', '".$_POST['type_seance']."')");
$transactDB->query("update reservation_client set nb_seance=nb_seance-1 where id = ".$_POST['id_client']);
$transactDB->commit();
} catch (Exception $e) {
$transactDB->rollback();
}
header('Location: page_client.php');
}
?>