30 lines
741 B
PHP
30 lines
741 B
PHP
<?php
|
|
|
|
require_once("lib/getPDD.php");
|
|
|
|
$bdd = getPDO();
|
|
|
|
if ($bdd instanceof PDO) {
|
|
try {
|
|
$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();
|
|
}
|
|
|
|
$photos = $req->fetchAll();
|
|
$req->closeCursor();
|
|
|
|
$req = $bdd->prepare("SELECT * FROM Categorie");
|
|
$req->execute();
|
|
|
|
$categories = $req->fetchAll();
|
|
$req->closeCursor();
|
|
} catch (Exception $e) {
|
|
$alert = choixAlert("query");
|
|
}
|
|
} elseif ($bdd instanceof Exception)
|
|
$alert = choixAlert("query");
|