-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsalaryPaymentMethodFunc.php
55 lines (26 loc) · 1.14 KB
/
salaryPaymentMethodFunc.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 include "config.php";
if (isset($_POST['submit'])){
$username = $_POST['username'];
$bank = $_POST['bank'];
$branch = $_POST['branch'];
$number = $_POST['accountNumber'];
$checkQuery = "SELECT * FROM loginuser where username = '$username'";
$run = mysqli_query($mysqli,$checkQuery);
if(mysqli_num_rows($run)){
$query = "SELECT * FROM salaryPaymentMethod where username='$username'";
$result = mysqli_query($mysqli,$query);
if(mysqli_num_rows($result)==1){
$updateQuery = "update salaryPaymentMethod set bank='$bank',branch='$branch',accountNumber='$number' where username='$username'";
$run_query = mysqli_query($mysqli,$updateQuery);
}
else{
$insertQuery = "INSERT INTO salaryPaymentMethod (username,bank,branch,accountNumber) VALUES ('$username','$bank','$branch','$number')" ;
$run_query = mysqli_query($mysqli,$insertQuery);
}
header("Location:salaryPaymentMethod.php");
}
else{
header("Location:incorrectUsername.php");
}
}
?>