alpha_full/admin/pages/items/fetchClassesCss.php
2026-04-06 22:58:51 +02:00

36 lines
1.1 KiB
PHP
Executable File

<?php
$nomFicAppelant = basename(__FILE__);
// mon premier ajax, merci tchatGPT, fichier appelé par JS
session_start();
$includePathConf="../../../../../_conf";
// $includePathConf="../_conf";
include ("../../../../../_include/dataBaseConnect.php");
$theVoletCss = isset($_GET['theVoletCss']) ? ($_GET['theVoletCss']) : '';
$nomThemeCss = isset($_GET['theme']) ? ($_GET['theme']) : '';
if (isset($debug[2]) && $debug[2] == '1' ) {echo "fetchClasses.php debug ". $theVoletCss ;}
if (empty($theVoletCss)) {
echo json_encode([]);
exit;
}
// Requête préparée correctement
$sql = "SELECT nom , description
FROM `$nomThemeCss`
WHERE UCASE(theme) LIKE UCASE(:theVoletCss)
ORDER BY description ASC";
if (isset($debug[2]) && $debug[2] == '1' ) {
header('Content-Type: text/plain');
echo "Requête SQL :\n$sql\n";
echo "Paramètres :\n";
print_r([':theVoletCss' => "%$theVoletCss%"]);
exit;
}
$stmt = $idPdo->prepare($sql);
$stmt->execute([':theVoletCss' => "%$theVoletCss%"]);
echo json_encode($stmt->fetchAll(PDO::FETCH_ASSOC));
?>