-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex1.php
57 lines (53 loc) · 1.3 KB
/
index1.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
53
54
55
56
57
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>查看留言版內容</title>
</head>
<body>
<a href="insert.php">新增留言</a><br>
<?php
$link= @mysqli_connect(
'localhost',
'travel',
'tra1043342',
'travel');
mysqli_query($link,'SET NAMES utf8');
$sql = "select comment_username,comment_email,comment_title,comment_content from comment";
$sql2=mysqli_query($link,$sql);
$rows=@mysqli_num_rows($sql2);
if($rows==""){
echo "查無資料! <br>";
}
else{
echo "留言板目前總共有 ".$rows." 筆資料喔! <br>";
}
while($list3=mysqli_fetch_assoc($sql2)){
?>
<table border="1" width="100%">
<tr><td width="40%">
留言者姓名:
<?php
if($list3['comment_email']!=""){
?>
<a href="mailto:<?php echo $list3['comment_email']; ?>">
<?php echo $list3['comment_username']; ?></a>
<?php }
else
{
?>
<?php echo $list3['comment_username']; ?>
<?php
} ?>
</td><td width="60%">主題:
<?php echo strip_tags($list3['comment_title']); ?></td>
</tr><tr>
<td column="2">
<?php echo nl2br($list3['comment_content']); ?></td>
</tr></table><br>
<?php
}
mysqli_free_result($sql2);
mysqli_close($link);
?>
</body>
</html>