You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PROJET-WEB_STRI1A/WEB/ressources/voiture.php

25 lines
1.2 KiB
PHP

<?php
function addVoiture($db, $matricule, $marque, $modele, $nbplaces, $anneefab){
$requete = "INSERT INTO public.voiture (matricule, marque, modele, nbplaces, anneefab, mail) VALUES ('" . $matricule . "','" . $marque . "','" . $modele . "','" . $nbplaces . "','" . $anneefab . "','" . $_SESSION['mail'] . "');";
pg_query($db, $requete);
}
function changeVoiture($db, $matricule, $marque, $modele, $nbplaces, $anneefab){
$requete = "UPDATE public.voiture SET (matricule, marque, modele, nbplaces, anneefab) = ('" . $matricule . "','" . $marque . "','" . $modele . "','" . $nbplaces . "','" . $anneefab . "') WHERE mail = '" . $_SESSION['mail'] . "';";
pg_query($db, $requete);
}
function showVoiture($db){
$requete = "SELECT * FROM public.voiture WHERE voiture.mail = '" . $_SESSION['mail'] . "';";
if ($donnees = 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>";
}
}
}
?>