-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview-club.php
36 lines (35 loc) · 1.18 KB
/
view-club.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
<?php include 'nav-admin.php';?>
<h2>These are the list of clubs</h2>
<?php
// This script retrieves all the records from the `soccer`.`clubs` table.
require 'mysqli-connect.php'; // Connect to the database.
// Make the query:
$q = "SELECT * FROM `clubs`";
$result = @mysqli_query($dbcon, $q); // Run the query.
if ($result) {
// If it ran OK, display the records.
// Table header.
echo '<table>
<tr>
<td><b>Club No</b></td>
<td><b>Name of club</b></td>
</tr>';
// Fetch and print all the records:
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
echo '<tr>
<td class="text-center">' . $row['id'] . '</td>
<td>' . $row['noc'] . '</td>
</tr>';
}
echo '</table>'; // Close the table.
mysqli_free_result($result); // Free up the resources.
} else {
// If it did not run OK.
// Public message:
echo '<p class="alert-box alert round">The current users could not be retrieved. We apologize for any inconvenience.</p>';
// Debugging message:
echo '<p>' . mysqli_error($dbcon) . '<br><br />Query: ' . $q . '</p>';
} // End of if ($r) IF.
mysqli_close($dbcon); // Close the database connection.
include 'footer.php';
?>