| Current Path : /home/xbodynamge/www/reservation/coach/ |
| Current File : /home/xbodynamge/www/reservation/coach/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".$DB_prefixtable."reservation where id = ".$_POST['id_reservation']);
$transactDB->query("update reservation".$DB_prefixtable."client set nb_seance=nb_seance+1 where id = ".$_POST['id_client']);
$transactDB->commit();
} catch (Exception $e) {
$transactDB->rollback();
}
header('Location: '.$_POST['nextpage']);
}
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".$DB_prefixtable."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".$DB_prefixtable."client set nb_seance=nb_seance-1 where id = ".$_POST['id_client']);
$transactDB->commit();
} catch (Exception $e) {
$transactDB->rollback();
}
header('Location: '.$_POST['nextpage']);
}
?>