%
// DB Connect
include "../inc/dbconnect.inc";
include "../inc/counterview.inc";
$h_page = getenv("SERVER_NAME");
$board = "qna";
$Table_Name = "Free_Board";
$Admin_Page = "../admin/admin_menu.html"; //°ü¸®ÀÚ ÆäÀÌÁö
$C_Page = "qna_list.html"; //ÇöÁ¦ ÆäÀÌÁö
$V_Page = "qna_view.html"; //º¸±â ÆäÀÌÁö
$S_Page = "qna_search.html"; //°Ë»ö ÆäÀÌÁö
$W_Page = "qna_write.html"; //¾²±â ÆäÀÌÁö
$pageSize = 10; // ÆäÀÌÁö´ç ¸®½ºÆ® °³¼ö
$block_page = 10; // ÆäÀÌÁöÀ̵¿ °³¼ö
if ($curPage == ""){
$curPage=1;
}
$list_NO = $pageSize * ($curPage-1);
//$SQLString = "SELECT COUNT(no) AS total FROM $Table_Name";
//$SQLString = $SQLString . " Where board = '$board'";
//$Rs = mysql_query($SQLString,$DBConn);
//$SQLString = "";
//$total_record = mysql_result($Rs,0,"total"); //ÃÑ µî·ÏµÈ¼ö
//mysql_free_result($Rs);
//if ($total_record <= 0) $total_record = 0; // ÃѰԽù°ÀÇ °ªÀÌ ¾ø°Å³ª ÇÒ°æ¿ì ±âº»°ªÀ¸·Î ¼¼ÆÃ
//$total_page = floor(($total_record - 1) / $pageSize) + 1; // ÃÑ ÆäÀÌÁö ¼ö
$condi_url = "";
if ($search == "Yes") {
// °Ë»ö Á¶°Ç
$condi_url = "&search=$search&writer=$writer&subject=$subject&comment=$comment&s_word=$s_word";
$S_Result = "SELECT no,subno,depno,writer,regdate,subject,email,visit FROM $Table_Name WHERE board = '$board' AND " ;
$S_Count = "SELECT COUNT(no) AS total_cnt FROM $Table_Name WHERE board = '$board' AND " ;
if( $writer == "ON" ) {
$S_Result = $S_Result . " writer Like '%$s_word%' ";
$S_Count = $S_Count . " writer Like '%$s_word%' ";
}
if( $subject == "ON" ) {
if( $writer == "ON" ) {
$S_Result = $S_Result . "OR ";
$S_Count = $S_Count . "OR ";
}
$S_Result = $S_Result . "subject Like '%$s_word%' ";
$S_Count = $S_Count . "subject Like '%$s_word%' ";
}
if ( $comment == "ON" ) {
if( $writer == "ON" || $subject == "ON" ) {
$S_Result = $S_Result . "OR ";
$S_Count = $S_Count . "OR ";
}
$S_Result = $S_Result . "comment Like '%$s_word%' ";
$S_Count = $S_Count . "comment Like '%$s_word%' ";
}
$S_Result = $S_Result . " ORDER By no DESC";
} else {
$S_Result = "Select no,subno,depno,writer,regdate,subject,email,visit From $Table_Name Where board = '$board' ORDER By no DESC";
$S_Count = "Select Count(no) AS total_cnt From $Table_Name Where board = '$board'";
}
$Rs = mysql_query($S_Count,$DBConn);
$S_Count = "";
$total_record = mysql_result($Rs,0,"total_cnt");
mysql_free_result($Rs);
if ($total_record <= 0) $total_record = 0; // ÃѰԽù°ÀÇ °ªÀÌ ¾ø°Å³ª ÇÒ°æ¿ì ±âº»°ªÀ¸·Î ¼¼ÆÃ
$total_page = floor(($total_record - 1) / $pageSize) + 1; // ÃÑ ÆäÀÌÁö ¼ö
$S_Result = $S_Result . " Limit $list_NO,$pageSize";
$Rs = mysql_query($S_Result,$DBConn);
$S_Result = "";
$postcount = mysql_num_rows($Rs);
%>
::::: ¼¿ï°Ë»çÁÖ½Äȸ»ç :::::
<%
mysql_free_result($Rs);
include "../inc/dbclose.inc";
%>