25 lines
675 B
PHP
25 lines
675 B
PHP
|
<?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");
|