forked from maxsterly43/task1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
50 lines (50 loc) · 1.94 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
<html>
<head>
<meta charset = "utf-8">
<link rel = "stylesheet" href = "/style.css">
</head>
<body>
<?php require "/connectBD.php";?>
<table>
<caption>Таблица книг</caption>
<tr>
<?php
$result = mysqli_query($connection,"SHOW COLUMNS FROM books");
while($column = mysqli_fetch_row($result)){
?>
<th><?=$column[0]?></th>
<?php
}
?>
<form action = "/changeBD.php" method = "POST">
<th><input type = "submit" name = "add" value = "добавить"><th>
</form>
</tr>
<?php
mysqli_free_result($result);
$result = mysqli_query($connection,"SELECT * FROM `books`");
while($row = mysqli_fetch_row($result)){
?>
<tr>
<?php
foreach($row as $cell){
?>
<td><?=$cell?></td>
<?php
}
$id = $row[0];
?>
<form action = "/changeBD.php" method = "POST">
<td><input type = "submit" name = "change" value = "Изменить <?=$id?>" ></td>
</form>
<form action = "/edit.php" method = "POST">
<td><input type = "submit" name = "del" value = "Удалить <?=$id?>" ></td>
</form>
</tr>
<?php
}
mysqli_free_result($result);
?>
</table>
</body>
</html>