| Current Path : /home/x/b/o/xbodynamge/www/reservation/admin/ |
| Current File : /home/x/b/o/xbodynamge/www/reservation/admin/action_block_reservation.php |
<?php
include_once('init.inc.php');
if ($_POST['salle']!="" && $_POST['client']!="" && $_POST['bloc_date']!="" && $_POST['type_seance']!="" && $_POST['heure_debut']!="" && $_POST['heure_fin']!=""){
echo $sql = "SELECT * from reservation".$DB_prefixtable."bloc where lib_bloc='".$_POST['bloc_date']."'";
$req = mysqli_query($db, $sql) or die('Erreur SQL !'.mysqli_error());
$nbseance=0;
while($date_block = mysqli_fetch_assoc($req)):
$date_block['date'];
$sql = "insert into reservation".$DB_prefixtable."reservation (id_client, id_salle, date, heure_deb, heure_fin, type_seance) value ('".$_POST['client']."','".$_POST['salle']."', '".$date_block['date']."', '".$_POST['heure_debut']."', '".$_POST['heure_fin']."', '".$_POST['type_seance']."')";
$req2 = mysqli_query($db, $sql) or die('Erreur SQL !'.mysqli_error());
$nbseance++;
endwhile;
echo $sql = "update reservation".$DB_prefixtable."client set nb_seance = (nb_seance - ".$nbseance.") where id=".$_POST['client'];
$req3 = mysqli_query($db, $sql) or die('Erreur SQL !'.mysqli_error());
header('Location: page_creer_block_reservation.php?status=ok');
}
else{
header('Location: page_creer_block_reservation.php?status=ko');
}
?>