1
0
Fork 0
This repository has been archived on 2024-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
PHP_TP_Note/models/m_poll.php

25 lines
675 B
PHP
Raw Permalink Normal View History

2020-11-13 09:18:41 +01:00
<?php
require_once("lib/getPDD.php");
$bdd = getPDO();
if ($bdd instanceof PDO) {
if (isset($answer) and $answer) {
$req = $bdd->prepare("UPDATE Reponse SET nbChoisi = nbChoisi+1 WHERE repId = ?");
$req->execute(array($answer));
$req->closeCursor();
}
$req = $bdd->prepare("SELECT * FROM Sondage WHERE sonId = ?");
$req->execute(array($pollId));
$poll = $req->fetch();
$req->closeCursor();
$req = $bdd->prepare("SELECT * FROM Reponse WHERE sondId = ?");
$req->execute(array($pollId));
$answers = $req->fetchAll();
$req->closeCursor();
} elseif ($bdd instanceof Exception)
$alert = choixAlert("query");