-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch_result.php
More file actions
89 lines (83 loc) · 3.13 KB
/
Copy pathsearch_result.php
File metadata and controls
89 lines (83 loc) · 3.13 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
include $_SERVER['DOCUMENT_ROOT']."/practice/db2.php";
?>
<!doctype html>
<head>
<meta charset="UTF-8">
<title>게시판</title>
<link rel="stylesheet" type="text/css" href="/practice/css/style.css" />
</head>
<body>
<div id="board_area">
<!-- 18.10.11 검색 추가 -->
<?php
/* 검색 변수 */
$catagory = $_GET['catgo'];
$search_con = $_GET['search'];
?>
<h1><?php echo $catagory; ?>에서 '<?php echo $search_con; ?>'검색결과</h1>
<h4 style="margin-top:30px;"><a href="index.php">홈으로</a></h4>
<table class="list-table">
<thead>
<tr>
<th width="70">번호</th>
<th width="500">제목</th>
<th width="120">글쓴이</th>
<th width="100">작성일</th>
<th width="100">조회수</th>
</tr>
</thead>
<?php
$sql2 = mq("select * from board where $catagory like '%$search_con%' order by idx desc");
while($board = $sql2->fetch_array()){
$title=$board["title"];
if(strlen($title)>30)
{
$title=str_replace($board["title"],mb_substr($board["title"],0,30,"utf-8")."...",$board["title"]);
}
$sql3 = mq("select * from reply where con_num='".$board['idx']."'");
$rep_count = mysqli_num_rows($sql3);
?>
<tbody>
<tr>
<td width="70"><?php echo $board['idx']; ?></td>
<td width="500">
<?php
$lockimg = "<img src='/practice/img/lock.png' alt='lock' title='lock' with='20' height='20' />";
if($board['lock_post']=="1")
{ ?><a href='/practice/ck_read.php?idx=<?php echo $board["idx"];?>'><?php echo $title, $lockimg;
}else{?>
<!--- 추가부분 18.08.01 --->
<?php
$boardtime = $board['date']; //$boardtime변수에 board['date']값을 넣음
$timenow = date("Y-m-d"); //$timenow변수에 현재 시간 Y-M-D를 넣음
if($boardtime==$timenow){
$img = "<img src='/practice/img/new.png' alt='new' title='new' />";
}else{
$img ="";
}
?>
<!--- 추가부분 18.08.01 END -->
<a href='/practice/read.php?idx=<?php echo $board["idx"]; ?>'><span style="background:yellow;"><?php echo $title; }?></span><span class="re_ct">[<?php echo $rep_count;?>] </span></a></td>
<td width="120"><?php echo $board['name']?></td>
<td width="100"><?php echo $board['date']?></td>
<td width="100"><?php echo $board['hit']; ?></td>
</tr>
</tbody>
<?php } ?>
</table>
<!-- 18.10.11 검색 추가 -->
<div id="search_box2">
<form action="/practice/search_result.php" method="get">
<select name="catgo">
<option value="all">전체</option>
<option value="title">제목</option>
<option value="name">글쓴이</option>
<option value="content">내용</option>
</select>
<input type="text" name="search" size="40" required="required"/> <button>검색</button>
</form>
</div>
</div>
</body>
</html>