first commit theloftstore
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
include('include/headscript.php');
|
||||
require_once(__DIR__ . '/class/db-functions.php');
|
||||
|
||||
$db = DBHandlerSelect::getInstance();
|
||||
$pdo = $db->getConnection();
|
||||
|
||||
$idclient = isset($_GET['idclient']) && is_numeric($_GET['idclient']) ? intval($_GET['idclient']) : null;
|
||||
|
||||
try {
|
||||
if ($idclient) {
|
||||
$stmt = $pdo->prepare("SELECT * FROM importdb WHERE idclient = :idclient ORDER BY id DESC");
|
||||
$stmt->execute([':idclient' => $idclient]);
|
||||
} else {
|
||||
$stmt = $pdo->query("SELECT * FROM importdb ORDER BY id DESC");
|
||||
}
|
||||
echo json_encode($stmt->fetchAll(PDO::FETCH_ASSOC));
|
||||
} catch (Exception $e) {
|
||||
echo json_encode(['status' => 'error', 'message' => $e->getMessage()]);
|
||||
}
|
||||
Reference in New Issue
Block a user