-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddRecord.php
More file actions
executable file
·35 lines (33 loc) · 1.19 KB
/
Copy pathaddRecord.php
File metadata and controls
executable file
·35 lines (33 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
session_start() ;
if(!isset($_SESSION['user_id'])){
header("location: index.php") ;
}
include("connection.php") ;
$doctor_id = $_SESSION['user_id'] ;
$aadhar = $_POST['addaadhar'] ;
$date = $_POST['visit'] ;
$med = $_POST['medicines'] ;
$notes = $_POST['notes'] ;
$sql = "SELECT * FROM patient WHERE aadhar='$aadhar'" ;
$result = mysqli_query($link , $sql) ;
$count = mysqli_num_rows($result) ;
if($count==1){
$row = mysqli_fetch_assoc($result) ;
$patient_id = $row['user_id'] ;
}else{
echo "ERROR: Unable to run the fetch query" ;
}
// echo "<p>$patient_id</p>" ;
// echo "<p>$doctor_id</p>" ;
// echo "<p>$aadhar</p>" ;
// echo "<p>$med</p>" ;
// echo "<p>$notes</p>" ;
$sql = "INSERT INTO records (patient_id, doctor_id, patient_aadhar, visit_date, medicines, notes) VALUES ('$patient_id', '$doctor_id','$aadhar' , '$date', '$med', '$notes')" ;
$result = mysqli_query($link , $sql) ;
if(!$result){
echo "<div>ERROR: Unable to run the insert query.</div>" ;
}else {
header("location: AccessPatient.php?loginaadhar=$aadhar") ;
}
?>