-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb.php
More file actions
66 lines (52 loc) · 1.34 KB
/
db.php
File metadata and controls
66 lines (52 loc) · 1.34 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
66
<?php
$link = mysqli_connect("172.30.0.179", "root", "password", "dbtest");
/* Vérification de la connexion */
if (mysqli_connect_errno()) {
printf("Échec de la connexion : %s\n", mysqli_connect_error());
exit();
}
/* Retourne le nom de la base de données courante */
if ($result = mysqli_query($link, "SELECT DATABASE()")) {
$row = mysqli_fetch_row($result);
printf("La base de données courante est %s.\n", $row[0]);
mysqli_free_result($result);
}
/* Change la base de données en "world" */
mysqli_select_db($link, "dbtest");
$result = mysqli_query($link,"SELECT * FROM ps_playedsqlscripts");
echo "<h1>Contenu de 'ps_playedsqlscripts'</h1>";
echo "<table border='1'>;
<tr>
<th>id</th>
<th>name</th>
<th>ts</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['ts'] . "</td>";
echo "</tr>";
}
echo "</table>";
$result = mysqli_query($link,"SELECT * FROM data_table_1");
echo "<h1>Contenu de 'data_table_1'</h1>";
echo "<table border='1'>;
<p>
<tr>
<th>id</th>
<th>name</th>
<th>value</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['value'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($link);
?>