// TEMPORARY TABLE MAKE
$tmp_make=mysql_query(“create temporary table tmp (
sid int NOT NULL DEFAULT ‘0’ auto_increment,
board varchar(20) NOT NULL,
bid int(11) NOT NULL,
subject varchar(255) NOT NULL,
content text,
signdate int(10) NOT NULL,
PRIMARY KEY(sid)
)”);
// 게시판 환경 설정 테이블에서 각 게시판 BOARD 가져오기
$total_result =mysql_query(“select board from board_config where limit_user_level < $admin_level"); $board_total = mysql_num_rows($total_result); // BOARD 별로 게시판 돌면서 검색한다 for($i=0;$i<$board_total;$i++) { mysql_data_seek($total_result,$i); $board = mysql_fetch_array($total_result); $search=mysql_query(“select bid,subject,content,signdate from $board[board] where name like ‘%$key%’ or subject like ‘%$key%’ or content like ‘%$key%'”); $search_total=mysql_num_rows($search); // 검색 결과를 TEMPORARY 테이블에 집어 넣는다 for($j=0;$j<$search_total;$j++) { mysql_data_seek($search,$j); $row = mysql_fetch_array($search); $insert=mysql_query(“insert into tmp (board,bid,subject,content,signdate) values (‘$board[board]’,’$row[bid]’,’$row[subject]’,’$row[content]’,’$row[subject]’) “); } } // TEMPORARY 테이블 정보 가져오기 $result=mysql_query(“select * from tmp order by signdate”); $total=mysql_num_rows($result); echo “
검 색 어 $key 로 $total 개의 게시물이 검색 되었습니다 |
|||||||||
$board[subject] ——- $board[signdate] |
|||||||||