-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayer_info.php
More file actions
65 lines (47 loc) · 1.44 KB
/
player_info.php
File metadata and controls
65 lines (47 loc) · 1.44 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Players Info List</title>
</head>
<body>
<?php
include ("connection.php");
// Create connection
$conn = connection::connect();
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql="SELECT * FROM player ";
if ($result = $conn->query($sql)){
$ID = new ArrayIterator(array());
$name = new ArrayIterator(array());
$age = new ArrayIterator(array());
$country = new ArrayIterator(array());
$team = new ArrayIterator(array());
$it = new MultipleIterator;
$it->attachIterator($ID);
$it->attachIterator($name);
$it->attachIterator($age);
$it->attachIterator($country);
$it->attachIterator($team);
while($row = $result->fetch_assoc())
{
$ID[] = $row["ID"];
$name[] = $row["name"];
$age[] = $row["age"];
$country[] = $row["country"];
$team[] = $row["team"];
}
foreach($it as $e ){ ?>
<strong>Info of player # <?php echo $e[0]; ?></strong>
<ul>
<li><strong>Name: </strong><?php echo $e[1]; ?></li>
<li><strong>Age: </strong><?php echo $e[2]; ?></li>
<li><strong>Country: </strong><?php echo $e[3]; ?></li>
<li><strong>Team: </strong><?php echo $e[4]; ?></li>
</ul>
<?php }
} ?>
</body>
</html>