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_TP4/models/m_accueil.php

31 lines
741 B
PHP
Raw Permalink Normal View History

2020-10-16 11:57:47 +02:00
<?php
require_once("lib/getPDD.php");
$bdd = getPDO();
if ($bdd instanceof PDO) {
try {
2020-10-27 22:23:11 +01:00
$req = null;
if ($category !== 0) {
$req = $bdd->prepare("SELECT * FROM Photo where catId = ?");
$req->execute(array($category));
} else {
$req = $bdd->prepare("SELECT * FROM Photo");
$req->execute();
}
2020-10-16 11:57:47 +02:00
$photos = $req->fetchAll();
$req->closeCursor();
2020-10-27 22:23:11 +01:00
$req = $bdd->prepare("SELECT * FROM Categorie");
$req->execute();
$categories = $req->fetchAll();
$req->closeCursor();
2020-10-16 11:57:47 +02:00
} catch (Exception $e) {
$alert = choixAlert("query");
}
} elseif ($bdd instanceof Exception)
$alert = choixAlert("query");