From 73453f6a46b1f97db38edca175a3082f2bb4f676 Mon Sep 17 00:00:00 2001 From: hritikkothari Date: Wed, 15 Jan 2020 01:00:24 +0530 Subject: [PATCH] added : update case functionality to admin panel --- admin/currentcases.php | 6 +- admin/updatecase.php | 122 +++++++++++++++++++++++++++++++++++++++++ admin_dashboard.php | 2 + includes/db.php | 2 +- 4 files changed, 128 insertions(+), 4 deletions(-) create mode 100644 admin/updatecase.php diff --git a/admin/currentcases.php b/admin/currentcases.php index 0ef67d8..98e3f8c 100644 --- a/admin/currentcases.php +++ b/admin/currentcases.php @@ -53,13 +53,13 @@ if ($con) { $x=1; $stmt = $con->prepare(" - SELECT case_type, case_details, next_hearing_date, prev_hearing_date, court_name + SELECT case_id, case_type, case_details, next_hearing_date, prev_hearing_date, court_name FROM cases WHERE case_status = ?"); $status = "pending"; $stmt->bind_param('s', $status); $stmt->execute(); $stmt->store_result(); - $stmt->bind_result($case_type, + $stmt->bind_result($case_id, $case_type, $case_details, $next_hearing_date, $prev_hearing_date, $court_name); @@ -73,7 +73,7 @@ {$next_hearing_date} Pending {$court_name} - + Update "; $x++; diff --git a/admin/updatecase.php b/admin/updatecase.php new file mode 100644 index 0000000..85b4d0e --- /dev/null +++ b/admin/updatecase.php @@ -0,0 +1,122 @@ +
+
+ + + + prepare(" + SELECT case_type, case_details, next_hearing_date, prev_hearing_date, + case_status, court_name + FROM cases WHERE case_id=?"); + $stmt->bind_param('i', $_GET['id']); + $stmt->execute(); + $stmt->store_result(); + $stmt->bind_result($case_type, $case_details, $next_hearing_date, + $prev_hearing_date, $case_status, $court_name); + while ($stmt->fetch()) { + $c_type = $case_type; + $c_details = $case_details; + $next_hearing = $next_hearing_date; + $prev_hearing = $prev_hearing_date; + $c_status = $case_status; + $c_name = $court_name; + } + } + ?> +
+

Update Case

+
+
+
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ +
+ +
+
+ + +prepare("UPDATE cases SET + case_type = ?, case_details = ?, next_hearing_date = ?, + prev_hearing_date = ?, case_status = ?, court_name = ? + WHERE case_id = ? "); + + $stmt->bind_param('ssssssi', $case_type, $case_details, $next_hearing_date, + $prev_hearing_date, $case_status, $court_name, $case_id); + $stmt->execute(); + echo "updated case"; + } +} +?> diff --git a/admin_dashboard.php b/admin_dashboard.php index 933e6af..85c7c6e 100644 --- a/admin_dashboard.php +++ b/admin_dashboard.php @@ -45,6 +45,8 @@ require_once("admin/managelawyers.php"); elseif($_GET['q'] == "feedbacks") require_once("admin/feedbacks.php"); + elseif($_GET['q'] == "updatecase") + require_once("admin/updatecase.php"); ?> diff --git a/includes/db.php b/includes/db.php index e96a7ba..0df73e0 100644 --- a/includes/db.php +++ b/includes/db.php @@ -2,7 +2,7 @@ $host = 'localhost'; $user = 'root'; -$pwd = 'pw'; +$pwd = 'db'; $db = 'court_case_management'; $con = new mysqli($host, $user, $pwd, $db);