Example #1
0
function modifFamille($idbbsitting, $idfamille, $nom, $nbenfants, $idlangue1, $pays, $francais, $bdd)
{
    // echo "nom: ";print_r($nom);echo ", nb enfants: ";print_r($nbenfants);echo ", id langue 1: ";print_r($idlangue1);echo ", pays: ";print_r($pays);echo"<br />bdd: ";var_dump($bdd);die;
    $verif = verifIdFamille($idfamille, $bdd);
    // $verif['bool']=true;
    if ($verif == true) {
        $requete = $bdd->prepare('UPDATE famille SET nom_famille= :nom, nombre_enfants= :nbenfants, id_langue_1= :id_langue, francais= :francais, pays = :pays WHERE id_famille= :id_famille');
        $requete->execute(array(':nom' => $nom, 'nbenfants' => $nbenfants, 'id_langue' => $idlangue1, 'francais' => $francais, 'pays' => $pays, 'id_famille' => $idfamille));
        $reponse["commentaire"] = "Modification effectuée";
        $reponse["id_modif"] = $idbbsitting;
        $reponse["erreur"] = 0;
    } else {
        $reponse["commentaire"] = "Cette famille n'existe pas !";
        $reponse["erreur"] = 1;
    }
    return $reponse;
}
<?php

include "header.html";
include "fonctions.php";
if (isset($_GET["id"]) && verifIdFamille($_GET["id"], $bdd) == true) {
    $idbbsitting = $_GET["id"];
} else {
    header('Location:listbbsitting.php');
}
$bbsitting = infobbsitting($idbbsitting, $bdd);
// print_r($_GET["id"]); echo "    "; print_r($idbbsitting);
// var_dump($bbsitting);
?>

<h1>Votre babysitting</h1>
</header>

<div class="container">

  <div class="row">
    <div class="col-md-4">
      <h3>La famille</h3>
		<p>Nom: <?php 
echo $bbsitting["nom_famille"];
?>
<br />
			Nombre d'enfants: <?php 
echo $bbsitting["nombre_enfants"];
?>
<br />
			Langue parlée: <?php