-
Notifications
You must be signed in to change notification settings - Fork 0
/
patientRegister.php~
68 lines (62 loc) · 2.18 KB
/
patientRegister.php~
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
if(isset($_REQUEST))
{
include('session.php');
include('functions.php');
$conn = new mysqli("localhost","root","root","teleraddb");
error_reporting(E_ALL && ~E_NOTICE);
$patientName=$_POST['patientName'];
$originalDate=$_POST['dob'];
// $originalDate = "2010-03-21";
$dob = date("Y-m-d", strtotime($originalDate));
$patientGender=$_POST['patientGender'];
$patientAddress1=$_POST['patientAddress1'];
$patientAddress2=$_POST['patientAddress2'];
$patientPincode=$_POST['patientPincode'];
$patientUsername=$_SESSION['gateway'];
date_default_timezone_set('Asia/Kolkata');
$datetime = date('Y-m-d H:i:s');
$sql = "INSERT INTO patient_table (patient_id, name, dob, gender, address1, address2, datetime, pincode) VALUES ('$patientUsername', '$patientName', '$dob', '$patientGender', '$patientAddress1', '$patientAddress2', '$datetime', '$patientPincode')";
$result = $conn->query($sql);
if($result) {
// echo 'successful';
$sql = "SELECT id FROM patient_table WHERE patient_id='$patientUsername'";
$result = $conn->query($sql);
$row = $result->fetch_object();
$patient_id = $_SESSION['gateway'].$row->id;
//echo $patient_id;
$sql="UPDATE patient_table SET patient_id ='$patient_id' WHERE id='$row->id'";
$result = $conn->query($sql);
if($result) {
// echo 'successful';
} else {
die('Error :'.$conn->error);
}
} else {
die('Error :'.$conn->error);
}
$conn->close();
// echo $_SESSION['gateway'];
// include('clientPatient.php');
$conn = new mysqli("localhost","root","root","teleraddb");
$clientID = getIdByGateway($_SESSION['gateway']);
$patientID = getIdByPatientID($patient_id);
echo $patientID;
date_default_timezone_set('Asia/Kolkata');
$datetime = date('Y-m-d H:i:s');
$sql = "INSERT INTO client_patient_table (fk_client, fk_patient, datetime) VALUES ('$clientID', '$patientID', '$datetime')";
$result = $conn->query($sql);
if($result) {
// echo 'insert into patient table successful<br>';
/*$sql = "SELECT id FROM client_table WHERE gateway = \"$centerUsername\"";
$result = $conn->query($sql);
while($row = $result->fetch_object())
{
$pid = $row->id;
}*/
} else {
die('Error :'.$conn->error);
}
$conn->close();
}
?>