| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 
 |   <?
include ("connect.php"); //appel connect.php
$datedep=$_POST["txt_datedep"];
$dateret=$_POST["txt_dateret"];
$nom=$_POST["nompren"];
$des=$_POST["txt_des"];
$hf=$_POST["txt_hf"];
$hd=$_POST["txt_hd"];
$per=$_POST["per"];
$codveh=$_POST["txt_cod"];
$tesdd=("select heuredep 
from reserver
where codveh='$codveh'
and datedep between '$datedep' and '$dateret'
and heuredep between '$hd' and '$hf
union
select heuredep
from reserver
where codveh='$codveh'
and dateret between '$datedep' and '$dateret
and heureret between '$hf' and '$hf'");
$testreq = pg_query($test, $tesdd);
echo $testreq;
if (($datedep > $dateret) or ($hd > $hf))
 
{
echo "Vous avez saisies une date ou une heure de départ suppérieure a la date ou l'heure de retour";
?>
 
<p><a href="ajouter.php">Recommencer la réservation</a></p>
  <?
}
 
else
 
{
	if ($testreq = '') "le teste ce fait la, si = blanc alors on reserve sinon ca nous dit deja reserver"
 
	{
		$req1="insert into reserver (datedep, dateret, heuredep, heureret, nompren, lieu, codveh, peracc) values ('$datedep', '$dateret', '$hd', '$hf', '$nom','$des', '$codveh', '$per')";
		echo $req1;
		$res1=pg_query($test,$req1);
 
	}
	else
	{
		echo "Véhicule deja réserver !";
		echo $testreq;
	}
}
include ("deconnect.php");  // deconnection de la base
?> | 
Partager