-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransaction.php
50 lines (43 loc) · 1.17 KB
/
transaction.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
<?php
/**
* Created by IntelliJ IDEA.
* User: ACER
* Date: 7/9/2019
* Time: 3:33 PM
*/
?>
<?php
$iid = $_POST['txtItemID'];
$name = $_POST['txtItemName'];
$price = $_POST['txtUprice'];
$qty = $_POST['txtQty'];
$oid = $_POST['txtOrderID'];
$date = $_POST['txtDate'];
$cid = $_POST['txtCustomerID'];
$price=$_POST['txtprice'];
include 'DB-Connection.php';
if (!$connection) {
echo mysqli_connect_errno();
} else {
mysqli_autocommit($connection, false);
$sql1 = "insert into orders values ('$oid','$cid','$date')";
$sql2 = "insert into orderDetail values ('$oid','$iid','$qty','$price')";
$customerRESt = mysqli_query($connection, $sql1);
if ($customerRESt) {
echo "Order Added";
$itemREST = mysqli_query($connection, $sql2);
if ($itemREST) {
mysqli_commit($connection);
// echo "kkkkkk";
} else {
mysqli_rollback($connection);
echo "item not add", mysqli_errno($connection);
mysqli_error($connection);
}
} else {
echo "Order Not Added", mysqli_error($connection);
}
mysqli_autocommit($connection, true);
mysqli_close($connection);
}
?>