MàJ entête + mineures

This commit is contained in:
Timothée Huneau 2025-03-22 16:53:35 +01:00
parent 90be5dd519
commit 33623b0aa1
4 changed files with 12 additions and 9 deletions

View file

@ -1,5 +1,4 @@
<?php
$c = seConnecter();
<?php
$titrePartUn = '???';
$titrePartDeux = '???';
@ -8,6 +7,7 @@ $pageExiste = false;
$type = NULL;
$table = NULL;
$idElement = NULL;
if (isset($_GET['type'])){
@ -55,11 +55,9 @@ if (isset($_GET['type'])){
mysqli_query($c, $reqNvl);
}
$requeteId = "SELECT * FROM $table WHERE id=$idElement;";
$resultatId = mysqli_query($c, $requeteId);
$infoElement = mysqli_fetch_assoc($resultatId);
$infoElement = ($table) ? getElementWithElementId($idElement, $table) : false;
$pageExiste = ($infoElement) ? true : false ;
$titrePartDeux = $infoElement['nom'];
$titrePartDeux = ($pageExiste) ? $infoElement['nom'] : $titrePartDeux;
}
}
@ -69,6 +67,4 @@ $titrePage = $titrePartUn . ' : ' . $titrePartDeux;
$_SESSION['tableDernierElemVu'] = $table;
$_SESSION['typeDernierElemVu'] = $type;
$_SESSION['idDernierElemVu'] = $idElement;
deconnectBD($c);
?>

Binary file not shown.

View file

@ -5,7 +5,7 @@ function getDB() {return new SQLite3("db/cuisine.db");}
function getAssocFromQueryString($qs){
$db = getDB();
$stmt = $db->prepare($qs);
$result = $stmt->execute();
$result = $stmt ? $stmt->execute() : false;
$assocArray = [];
while ($ligne = $result->fetchArray(SQLITE3_ASSOC)){
$assocArray[] = $ligne;
@ -185,6 +185,12 @@ function safePutUnite($nom){
return $db->exec($requete);
}
function getElementWithElementId($idElement, $table){
$requeteId = "SELECT * FROM $table WHERE id=$idElement;";
$resultat = getAssocFromQueryString($requeteId);
return ($resultat ? $resultat[0] : false);
}
// modification vaut false si on effectue une création de recette et l'id de la recette à modifier sinon
// les listes d'ingrédients, de préparation et d'ustensile sont des tableaux de tableaux indexés sur les id des éléments utilisés.
function insererRecette($infosRecette, $listeIngredients, $listeUstensile, $listePreparation, $listeReutilise, $modification){

View file

@ -2,4 +2,5 @@
<h1><a href= "index.php">
Cuisine et pâtisserie
</a></h1>
<p>Attention, ce site est en cours de refonte totale, il ne devrait pas être en production !</p>
</header>