prepare($sql); // Bind parameters $stmt->bindParam(':driverId', $driverId, PDO::PARAM_INT); $stmt->bindParam(':issueDate', $issueDate, PDO::PARAM_STR); $stmt->bindParam(':inspectionResult', $inspectionResult, PDO::PARAM_STR); // Execute the statement $stmt->execute(); // Check if the insertion was successful if ($stmt->rowCount() > 0) { jsonSuccess(null, "Criminal document data saved successfully"); } else { jsonError("Failed to save criminal document data"); } } catch (PDOException $e) { // Log the error and print a generic failure message error_log("Database Error: " . $e->getMessage()); jsonError("An error occurred while saving the data"); } ?>