forked from lfgcodeLinc/TeamRocket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
39 lines (30 loc) · 817 Bytes
/
index.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
<!DOCTYPE html>
<html>
<body>
<?php
// Set connection variables
$host = 'localhost';
$username = 'admin';
$database = 'collab';
$password = 'admin123';
// Connect to host
$connection = mysqli_connect($host, $username, $password, $database);
// Check connection
if ($connection->connect_error) {
die("Connection failed: " . $connection->connect_error);
}
// Select database (note: connection & database will be selected by default for rest of session)
$sql = "SELECT * FROM User";
$result = $connection->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "id: " . $row["UserID"]. "<br>";
}
} else {
echo "0 results";
}
$connection->close();
?>
</body>
</html>