forked from aemunahmar/DBProject
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdateCustomer.php
More file actions
28 lines (23 loc) · 1.03 KB
/
updateCustomer.php
File metadata and controls
28 lines (23 loc) · 1.03 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
<?php
session_start();
include('dbconnect.php');
if(isset($_SESSION['ldmanager1']))
{
$dbconnect = mysqli_connect("127.0.0.1", "root", "", "dealer_one");
$query = "UPDATE customer_d1 SET name= '$_POST[name]',address= '$_POST[address]',phone= '$_POST[phone]' WHERE customer_no= '$_POST[customer_no]'";
$output = $dbconnect->query($query);
} else if(isset($_SESSION['ldmanager2']))
{
$dbconnect = mysqli_connect("127.0.0.1", "root", "", "dealer_two");
$query = "UPDATE customer_d2 SET name= '$_POST[name]',address= '$_POST[address]',phone= '$_POST[phone]' WHERE buyer_no= '$_POST[buyer_no]'";
$output = $dbconnect->query($query);
}
if ($output === TRUE)
{
echo "<script>alert('Information has been updated'); window.location.href='allCustomers.html';</script>";
} else
{
//echo "Something went wrong" . "<br>" . $dbconnect->error;
echo "<script>alert('Something went wrong'); window.location.href='empAccount.html';</script>";
}
?>