1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| <?php
function getArt($id){ //Retourne l'article en fonction de l'ID
mysqli_report(MYSQLI_REPORT_ALL);
$conn = mysqli_connect('mysql5-8','xxxx','xxx', 'xxxx');
if (mysqli_connect_errno()) {
printf("Échec de la connexion : %s\n", mysqli_connect_error());
exit();
}
$res=array();
if ($stmt = mysqli_prepare($conn, "SELECT * FROM ARTICLES WHERE id = ?")) {
mysqli_stmt_bind_param($stmt, "i", $id);
mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt, $artID, $edition, $mois, $rub, $titre, $texte, $fest, $saison);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
echo $edition;
while($row = mysqli_fetch_array($result)){
$res[]=$row;
}
return $res;
mysqli_close($conn);
}
}
?> |
Partager