-
Notifications
You must be signed in to change notification settings - Fork 0
/
addcard.php
36 lines (31 loc) · 859 Bytes
/
addcard.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
<?php header('Access-Control-Allow-Origin: *');
include "initialize.php";
include "sql.php";
$QUERY = new Query();
$aadhar = $_REQUEST['aadhar'];
$name = $_REQUEST['name'];
$bgroup = $_REQUEST['bgroup'];
$contact = $_REQUEST['contact'];
$result = $QUERY->insert(array("Aadhar_No", "Name", "Last_Diag", "Blood_Group", "Emg_Contact"), array($aadhar, $name, date("Y-m-d"), $bgroup, $contact), "healthcard");
if($result)
{
$cardId = "";
$r = $QUERY->select("id","healthcard", "Aadhar_No", $aadhar);
if($r != NULL)
{
while($row = $r->fetch_assoc()){
$cardId = $row["id"];
}
}
$r = $QUERY->insert(array("Card_Id", "Health_Status", "Initial_Date"), array($cardId, "Healthy", date("Y-m-d")), "current_conditions");
if($r)
echo "success";
else
{
$QUERY->delete("healthcard", "Aadhar_No", $aadhar);
echo "failed";
}
}
else
echo "failed";
?>