-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathnewReceive.php
31 lines (26 loc) · 1.02 KB
/
newReceive.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
<?php
session_start();
$_SESSION["tab"] = "New Receive";
if($_SESSION["login"] != 1)
echo '<h2 txtcolor="red">Authentication Error!!!</h2>';
else{
include_once('header.php');
$pid = $_POST['pid'];
$units = $_POST['units'];
$hospital = $_POST['hospital'];
date_default_timezone_set("Asia/Calcutta");
$date = date('y-m-d');
$time = date('h:i');
$sql_1 = "insert into Receive (p_id, r_date, r_time, r_quantity, r_hospital) values('$pid', '$date', '$time', '$units', '$hospital')";
$sql_2 = "update Stock SET s_quantity = s_quantity - '$units' where Stock.s_blood_group = (select p_blood_group FROM Person where p_id = '$pid')";
if (($con->query($sql_1) === TRUE) and ($con->query($sql_2) === TRUE)) {
###########contents of div goes here###########
echo 'your Receiving is succesful';
###############################################
}
else {
echo "Error: " . $sql . "<br>" . $con->error;
}
include_once('footer.php');
}
?>