fixed some issues

This commit is contained in:
2024-10-28 19:07:15 +04:00
parent 761bc9a441
commit 100397a953
3 changed files with 48 additions and 16 deletions
+5 -4
View File
@@ -5,7 +5,7 @@ header('Content-Type: application/json');
$host = $servername;
$db = $database;
$user = $username;
$pass = $password;
$pass = $password;
try {
$pdo = new PDO("mysql:host=$host;dbname=$db", $user, $pass);
@@ -23,7 +23,8 @@ if (!isset($_POST['method'])) {
else {
$method = $_POST['method'];
if($method == 'intervention'){
$query = "SELECT * FROM temp_json_queue WHERE processed = 2";
$id = $_POST['id'];
$query = "SELECT * FROM temp_json_queue WHERE processed = 2 AND id = $id";
$stmt = $pdo->prepare($query);
$stmt->execute();
$jsonEntries = $stmt->fetchAll(PDO::FETCH_ASSOC);
@@ -34,7 +35,7 @@ foreach ($jsonEntries as $entry) {
$data = json_decode($entry['json_data'], true);
$uuid = $entry['uuid'];
$analysisArr = array();
$compoundsArr = array();
$compoundsArr = array();
// check for result_TestName
foreach ($data['product']['reports'] as $report) {
@@ -419,5 +420,5 @@ function markForIntervention($id, $pdo)
$query = "INSERT INTO notifications (`title`,`description`) VALUES ('Intervention Required', 'Intervention required for JSON entry with ID $id')";
$stmt = $pdo->prepare($query);
$stmt->execute();
}