|
|
@ -1,15 +1,14 @@
|
|
|
|
<?php
|
|
|
|
<?php
|
|
|
|
/*require ('../connectionBD.php');
|
|
|
|
require ('../connectionBD.php');
|
|
|
|
$mail = null;
|
|
|
|
$mail = null;
|
|
|
|
$db = connexionBD();
|
|
|
|
$db = connexionBD();
|
|
|
|
init();
|
|
|
|
init();
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$matricule = $_POST['matricule'];
|
|
|
|
$matricule = isset($_POST['matricule']) ? $_POST['matricule'] : NULL; //recuperation valeur formulaire, isset pour eviter l'erreur "Notice: Undefined index"
|
|
|
|
$marque = $_POST['marque'];
|
|
|
|
$marque = isset($_POST['marque']) ? $_POST['marque'] : NULL;
|
|
|
|
$modele = $_POST['modele'];
|
|
|
|
$modele = isset($_POST['modele']) ? $_POST['modele'] : NULL;
|
|
|
|
$nbplaces = $_POST['nbplaces'];
|
|
|
|
$nbplaces = isset($_POST['nbplaces']) ? $_POST['nbplaces'] : NULL;
|
|
|
|
$anneefab = $_POST['anneefab'];
|
|
|
|
$anneefab = isset($_POST['anneefab']) ? $_POST['anneefab'] : NULL;
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($_POST['submitadd']))
|
|
|
|
if(isset($_POST['submitadd']))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -38,26 +37,29 @@ function init(){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function addVoiture($matricule, $marque, $modele, $nbplaces, $anneefab){
|
|
|
|
function addVoiture($matricule, $marque, $modele, $nbplaces, $anneefab){
|
|
|
|
//global $db;
|
|
|
|
global $db;
|
|
|
|
$requete = "INSERT INTO public.voiture (matricule, marque, modele, nbplaces, anneefab, mail) VALUES ('".$matricule."','".$marque."','".$modele."','".$nbplaces."','".$anneefab."','mail');";
|
|
|
|
$requete = "INSERT INTO public.voiture (matricule, marque, modele, nbplaces, anneefab, mail) VALUES ('".$matricule."','".$marque."','".$modele."','".$nbplaces."','".$anneefab."','".$_SESSION['mail']."');";
|
|
|
|
//$requete = "INSERT INTO 'public'.'voiture' ('matricule','marque','modele','nbplaces','anneefab','mail') VALUES ('".$matricule."','".$marque."','".$modele."','".$nbplaces."','".$anneefab."','".$_SESSION['mail']."');";
|
|
|
|
pg_query($db, $requete);
|
|
|
|
echo "requete =".$requete;
|
|
|
|
|
|
|
|
//pg_query($db, $requete);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function changeVoiture($matricule, $marque, $modele, $nbplaces, $anneefab){
|
|
|
|
function changeVoiture($matricule, $marque, $modele, $nbplaces, $anneefab){
|
|
|
|
//global $db;
|
|
|
|
global $db;
|
|
|
|
|
|
|
|
$requete = "UPDATE public.voiture SET (matricule, marque, modele, nbplaces, anneefab) = ('".$matricule."','".$marque."','".$modele."','".$nbplaces."','".$anneefab."') WHERE mail = '".$_SESSION['mail']."';";
|
|
|
|
$requete = "UPDATE public.voiture SET (matricule, marque, modele, nbplaces, anneefab) = ('".$matricule."','".$marque."','".$modele."','".$nbplaces."','".$anneefab."') WHERE mail = 'mail';";
|
|
|
|
|
|
|
|
//$requete = "UPDATE public.voiture SET (matricule, marque, modele, nbplaces, anneefab) = ('".$matricule."','".$marque."','".$modele."','".$nbplaces."','".$anneefab."') WHERE mail = '".$_SESSION['mail']."';";
|
|
|
|
|
|
|
|
echo "requete =".$requete;
|
|
|
|
echo "requete =".$requete;
|
|
|
|
//pg_query($db, $requete);
|
|
|
|
pg_query($db, $requete);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function showVoiture(){
|
|
|
|
function showVoiture(){
|
|
|
|
//global $db;
|
|
|
|
global $db;
|
|
|
|
$requete = "SELECT * FROM voiture WHERE voiture.mail = '".$_SESSION['mail']."';";
|
|
|
|
$requete = "SELECT * FROM public.voiture WHERE voiture.mail = '".$_SESSION['mail']."';";
|
|
|
|
echo "requete =".$requete;
|
|
|
|
if($donnees = pg_query($db, $requete)){
|
|
|
|
//pg_query($db, $requete);
|
|
|
|
while($res = pg_fetch_assoc($donnees)){
|
|
|
|
|
|
|
|
echo "matricule = ".$res['matricule']."<br>";
|
|
|
|
|
|
|
|
echo "marque = ".$res['marque']."<br>";
|
|
|
|
|
|
|
|
echo "modele = ".$res['modele']."<br>";
|
|
|
|
|
|
|
|
echo "nombre de places = ".$res['nbplaces']."<br>";
|
|
|
|
|
|
|
|
echo "année de fabrication = ".$res['anneefab']."<br>";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
?>
|
|
|
|