= (int)$minPoids; } } return false; } function updateEventTitle($bdd, $eventid, $titre){ $stmt = mysqli_prepare( $bdd, "UPDATE evenements SET titre = ? WHERE id = ?" ); mysqli_stmt_bind_param($stmt, "si", $titre, $eventid); mysqli_stmt_execute($stmt); $success = mysqli_stmt_affected_rows($stmt) >= 0; mysqli_stmt_close($stmt); return $success; } function updateEventImage($bdd, $eventId, $image){ $stmt = mysqli_prepare( $bdd, "UPDATE evenements SET couverture = ? WHERE id = ?" ); mysqli_stmt_bind_param($stmt, "si", $image, $eventId); mysqli_stmt_execute($stmt); $success = mysqli_stmt_affected_rows($stmt) >= 0; mysqli_stmt_close($stmt); return $success; } function getSpecificActus($bdd, $id) { $results = mysqli_query($bdd, "SELECT * FROM `actus` WHERE `id`=" . $id); $return = []; while ($row = mysqli_fetch_assoc($results)) { $return[] = $row; } return $return; } function updateActuImage($bdd, $actuId, $image){ $stmt = mysqli_prepare( $bdd, "UPDATE actus SET image = ? WHERE id = ?" ); mysqli_stmt_bind_param($stmt, "si", $image, $actuId); mysqli_stmt_execute($stmt); $success = mysqli_stmt_affected_rows($stmt) >= 0; mysqli_stmt_close($stmt); return $success; } function updateActuTitle($bdd, $actuId, $titre){ $stmt = mysqli_prepare( $bdd, "UPDATE actus SET titre = ? WHERE id = ?" ); mysqli_stmt_bind_param($stmt, "si", $titre, $actuId); mysqli_stmt_execute($stmt); $success = mysqli_stmt_affected_rows($stmt) >= 0; mysqli_stmt_close($stmt); return $success; } function updateActuContent($bdd, $actuId, $content){ $stmt = mysqli_prepare( $bdd, "UPDATE actus SET actu = ? WHERE id = ?" ); mysqli_stmt_bind_param($stmt, "si", $content, $actuId); mysqli_stmt_execute($stmt); $success = mysqli_stmt_affected_rows($stmt) >= 0; mysqli_stmt_close($stmt); return $success; } function createEvent($bdd, $titre, $date, $site){ $sql = "INSERT INTO evenements (date, titre, couverture, site_id) VALUES (?, ?, '', ?)"; $req = $bdd->prepare($sql); $req->bind_param("ssi", $date, $titre, $site); $req->execute(); return $bdd->insert_id; } function deleteEvent($bdd, $eventId){ $sql = "DELETE FROM evenements WHERE id = ?"; $req = $bdd->prepare($sql); $req->bind_param("i", $eventId); $req->execute(); return $req->affected_rows > 0; } function deleteActu($bdd, $eventId){ $sql = "DELETE FROM actus WHERE id = ?"; $req = $bdd->prepare($sql); $req->bind_param("i", $eventId); $req->execute(); return $req->affected_rows > 0; } function createActu($bdd, $titre, $actu, $date, $idSite){ $stmt = mysqli_prepare( $bdd, "INSERT INTO actus (titre, actu, date, idSite) VALUES (?, ?, ?, ?)" ); mysqli_stmt_bind_param($stmt, "sssi", $titre, $actu, $date, $idSite); mysqli_stmt_execute($stmt); $actuId = mysqli_insert_id($bdd); mysqli_stmt_close($stmt); return $actuId; }