<?php
include('../includes/db.php');

$id = $_POST['course_id'];
$status = $_POST['status'];
$code = $_POST['code'];
$name = $_POST['name'];
$modules = $_POST['modules'];

$sql = "UPDATE courses SET status=?, code=?, name=?, modules=? WHERE id=?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("ssssi", $status, $code, $name, $modules, $id);

if ($stmt->execute()) {
    echo "success";
} else {
    echo "Database error: " . $stmt->error;
}
?>
