-
Notifications
You must be signed in to change notification settings - Fork 0
/
getTotalCount.php
42 lines (29 loc) · 1.08 KB
/
getTotalCount.php
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
41
42
<?php
// Include the configuration file and autoload file from the composer.
require_once __DIR__ . '/../config/config.php';
require_once "vendor/autoload.php";
use brainwave\ErrorHandler;
use brainwave\Database;
use brainwave\ImageContentManager;
$errorHandler = new ErrorHandler();
// Register the exception handler method
set_exception_handler([$errorHandler, 'handleException']);
$database = new Database();
$pdo = $database->createPDO();
$args = [];
$gallery = new ImageContentManager($pdo, $args);
function main(): array {
return json_decode(file_get_contents('php://input'), true, 512, JSON_THROW_ON_ERROR);
}
$database_data = []; // Set a default value for $database_data
$database_data = main(); // Call the function to execute your code and get the decoded JSON data
$database_data['total_count'] = $gallery->countAllGallery($database_data['category']); // Total Records in the db table:
output($database_data);
function output($output): void
{
http_response_code(200);
try {
echo json_encode($output, JSON_THROW_ON_ERROR);
} catch (JsonException) {
}
}