22 lines
444 B
PHP
22 lines
444 B
PHP
<?php
|
|
require_once __DIR__ . '/../../connect.php';
|
|
|
|
// Prepare the SQL query to select all records from the employee table with a limit of 10
|
|
$sql = "SELECT
|
|
*
|
|
FROM
|
|
`employee` e
|
|
ORDER BY
|
|
e.created_at
|
|
DESC
|
|
";
|
|
|
|
// Prepare and execute the statement
|
|
$stmt = $con->prepare($sql);
|
|
$stmt->execute();
|
|
|
|
// Fetch all records as an associative array
|
|
$employee_data = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
jsonSuccess($employee_data ?: []);
|
|
?>
|