forked from rimo9/3.kodutoo-II-ruhm
/
table_post.php
52 lines (34 loc) · 934 Bytes
/
table_post.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
51
52
<?php
// table.php
require_once("functions.php");
require_once("header.php");
$text_list = getTextData();
//var_dump($car_list);
$emailtable = getEmailData();
//kas kasutaja tahab kustutada
// kas aadressireal on ?delete=??!??!?!
if(isset($_GET["delete"])){
// saadan kaasa id, mida kustutada
deletePost($_GET["delete"]);
}
?>
<table border=1 align="center" >
<tr>
<th>ID</th>
<th>user_id</th>
<th>text</th>
</tr>
<?php
// iga massiivis olema elemendi kohta
// count($car_list) - massiivi pikkus
for($i = 0; $i < count($text_list); $i++){
// $i = $i +1; sama mis $i += 1; sama mis $i++;
// tavaline rida
echo "<tr>";
echo "<td>".$text_list[$i]->post_kd."</td>";
echo "<td>".$text_list[$i]->user_id."</td>";
echo "<td>".$text_list[$i]->text."</td>";
echo "</tr>";
}
?>
</table>