-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforum.php
More file actions
49 lines (31 loc) · 912 Bytes
/
Copy pathforum.php
File metadata and controls
49 lines (31 loc) · 912 Bytes
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
<html>
<body>
<h1>Post a message!</h1>
<form action="foruminsert.php" method="POST">
Username: <input type="text" name="username"><br>
Message: <input type="text" name="message"><br>
<input type="submit" value="Submit">
</form>
<h1>Messages</h1>
</body>
</html>
<?php
$conn = mysqli_connect('student.cs.appstate.edu', "steinem", "900581306", "5450net");
if(mysqli_connect_errno()) {
echo "Failed to connect: " . mysqli_connect_error();
}
$result = mysqli_query($conn, "SELECT username, message FROM forum");
echo "<table border = '1'>
<tr>
<th>Username</th>
<th>Message</th>
<tr>";
while($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>". $row['username'] . "</td>";
echo "<td>". $row['message'] . "</td>";
echo "<tr>";
}
echo "</table>";
mysqli_close($conn);
?>