Files
intaleq_v3_pure_php/serviceapp/updatePackages.php
2026-04-28 13:04:27 +03:00

26 lines
842 B
PHP
Executable File

<?php
require_once __DIR__ . '/../connect.php';
// Get 'id' and 'version' from the request
$id = filterRequest("id");
$version = filterRequest("version");
$sql = "UPDATE `packageInfo` SET `version` ='$version' WHERE `id` = '$id'";
// Prepare and execute the statement
$stmt = $con->prepare($sql);
$stmt->execute();
error_log("Updating package: ID = $sql, Version = $version");
// Debugging: Check if the query affected any rows
if ($stmt->rowCount() > 0) {
// If rows were affected, print success
echo json_encode(['status' => 'success', 'message' => "Package version updated successfully for ID $id"]);
} else {
// If no rows were affected, print failure and debug the query
echo json_encode(['status' => 'failure', 'message' => "Failed to update package version. No rows affected. ID: $id, Version: $version"]);
}
?>