-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdetail.php
More file actions
71 lines (35 loc) · 1.29 KB
/
Copy pathdetail.php
File metadata and controls
71 lines (35 loc) · 1.29 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
67
68
69
70
71
<div align=center>
<a href="main.php"><button type="submit">На главную</button></a>
</div>
<?php
include 'db.php';
?>
<div align=justify>
<?php
$selectQuery = 'SELECT content, date, words_count FROM uploaded_text WHERE id = "'.$_POST['button'].'"'; //запрос выводит основной текст и его атрибуты в зависимости от id
$all_text = $pdo->query($selectQuery)->fetchAll(PDO::FETCH_ASSOC);
foreach ($all_text as $res){
echo $res['content'].'<br/>';
echo '<b>Дата добавления: '.date("d-m-Y",strtotime($res['date'])).'</b><br/>';
echo '<b>Количество слов: '.$res['words_count'].'</b><br/>';
}
?>
</div>
<?php
$selectQuery = 'SELECT text_id, word, count FROM word WHERE text_id = "'.$_POST['button'].'"'; // запрос выводит "слово-количество" из таблицы word по id
$text_detail = $pdo->query($selectQuery)->fetchAll(PDO::FETCH_ASSOC);
?>
<div align="center">
<table border="1" cellpadding="2">
<tbody>
<?php
foreach ($text_detail as $result){?>
<tr>
<td><?php echo $result['word'];?></td>
<td><?php echo $result['count'];?></td>
</tr>
<?php }
?>
</tbody>
</table>
</div>