-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmember_report.php
173 lines (72 loc) · 1.83 KB
/
member_report.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<html>
<head>
<style>
div.solid
{
background-color: hotpink;
width:300px;
margin: auto;
border: 3px solid black;
border-radius: 5px;
}
div.report
{
background-color: white;
text-align: left;
padding-left: 3px;
}
</style>
</head>
<body>
<center>
<!-- Database connection -->
<?php
$servername = "localhost";
$username = "rusty063_csadmin";
$password = "Test12345!";
$database = "rusty063_chocan";
$mysqli = new mysqli('localhost', $username, $password, $database);
$mysqli->select_db($database) or die( "Unable to select database");
echo 'Database Connected successfully<br>';
$m_id = $_POST['member_id'];
$m_name = $_POST['member_name'];
$m_email = $_POST['member_email'];
$m_status = $_POST['member_status'];
$sql = "INSERT INTO members(member_id, name, email, status)
VALUES($m_id, '$m_name', '$m_email', '$m_status')";
if($mysqli->query($sql) === TRUE)
{
echo "New record added successfully<br>SQL : " . $sql;
}
?>
<h1>ChocAn System</h1>
<div class = "solid">
<h3>Administrator System <sub><a href="../admin.php">Main Menu</a></sub></h3>
<hr>
<h3>Member Report</h3>
<div class = "report">
<?php
$sql = "SELECT * FROM members";
$result = $mysqli->query($sql);
if ($result->num_rows > 0)
{
// output data of each row
echo "\tID\t| Name\t| Email\t| Status <br>";
while($row = $result->fetch_assoc())
{
echo "<br>". $row["member_id"]. "\t| ". $row["name"]. "\t| " . $row["email"] . "\t| " . $row["status"];
}
}
else
{
echo "0 results";
}
?>
</div>
</div>
<?php
mysqli_close($mysqli);
?>
</center>
</body>
</html>