added params crud lines
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
include('include/headscript.php');
|
||||
|
||||
try {
|
||||
$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
||||
|
||||
if ($id <= 0) {
|
||||
echo json_encode(['success' => false, 'message' => 'Invalid parameter id.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$db = DBHandlerSelect::getInstance();
|
||||
$pdo = $db->getConnection();
|
||||
|
||||
$stmt = $pdo->prepare("
|
||||
SELECT id, line_id, position, short_label, label, icon
|
||||
FROM production_line_params
|
||||
WHERE id = :id
|
||||
");
|
||||
$stmt->execute([':id' => $id]);
|
||||
$param = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!$param) {
|
||||
echo json_encode(['success' => false, 'message' => 'Parameter not found.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'param' => $param
|
||||
]);
|
||||
} catch (Exception $e) {
|
||||
echo json_encode([
|
||||
'success' => false,
|
||||
'message' => 'Server error: ' . $e->getMessage()
|
||||
]);
|
||||
}
|
||||
Reference in New Issue
Block a user