-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoan-serch.php
More file actions
66 lines (64 loc) · 2.09 KB
/
Loan-serch.php
File metadata and controls
66 lines (64 loc) · 2.09 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<html>
<style>
table, th, td {
border: 1px solid black;
}
</style>
<body>
<h1 class="my-5">Hi, Welcome to the University Bank System.</h1>
<p><nav class="nav justify-content-center">
<a href="home.php">Home</a>
<a href="Customer-serch.php">Customer-serch</a>
<a href="Bank-serch.php">Bank-serch</a>
<a href="Accounts-serch.php">Accounts-serch</a>
<a href="Loan-serch.php">Loan-serch</a>
<a href="Employee-serch.php">Employee-serch</a>
</nav>
<p><h2>University Bank Search:</h2>
<h3><a href="Delete-loan.php">Delete-loan</a></h3></p>
<form action="Loan-serch.php" method=get>
Enter Loan_ID: <input type=text size=20 name="name">
<p>Enter Customer_ID: <input type=text size=5 name="id">
<p> <input type=submit value="submit">
<input type="hidden" name="form_submitted" value="1" >
</form>
<?php
include 'config.php';
if (!isset($_GET["form_submitted"]))
{
echo "Hello. Please enter a Bank name or ID number and submit the form.";
}
else {
$mysqli = new mysqli($servername, $username, $password,$db);
// Check connection
if ($mysqli->connect_error) {
die("Connection failed: " . $mysqli->connect_error);
}
$mysqli->set_charset('utf8');
if (!empty($_GET["name"]))
{
$profName = $_GET["name"];
$sql = "SELECT Loan_ID, Loan_Amount, Customer_ID FROM loan where Account_Number =$profName";
$result = $mysqli->query($sql);
}
elseif (!empty($_GET["id"]))
{
$profID = $_GET["id"];
$sql = "SELECT Loan_ID, Loan_Amount, Customer_ID FROM loan where Customer_ID = $profID";
$result = $mysqli->query($sql);
}
else {
echo "<b>Please enter a name or an ID number</b>";
}
if ($result->num_rows > 0) {
echo "<table><tr><th>Loan_ID</th><th>Loan_Amount</th><th>Customer_ID</th></tr>";
while($row = $result->fetch_assoc()) {
echo "<tr><td>".$row["Loan_ID"]."</td><td>".$row["Loan_Amount"]."</td><td> ".$row["Customer_ID"]."</td></tr>";
}
echo "</table>"; // close the table
echo "There are ". $result->num_rows . " results.";
} else {
echo "0 results";
}
$mysqli->close();
}