list.html
À§Ä¡:Ãß°¡¸ñ·Ï-ºí·°ÆäÀÌÁö¼ö Ä®¶ó&Å©±â º¯°æ
for($go_page=$first_page+1;$go_page<=$last_page;$go_page++){
//ºí·°ÆäÀÌÁö¼ö Ä®¶ó&Å©±â º¯°æ *½ÃÀÛ
if($go_page==$page){
echo "[$go_page]";//go_page:ÇöÀçÆäÀÌÁö
}else{
echo "[$go_page]";
}
//ºí·°ÆäÀÌÁö¼ö Ä®¶ó&Å©±â º¯°æ *³¡
}
search.html
À§Ä¡:ÀÚ·á°Ë»öÈÄ ¸µÅ©¿¬°á
while($row=mysql_fetch_array($result)){
echo "
$article_num |
$row[subject] |
$row[num] |
$row[name] |
$row[subject] |
$row[reg_date] |
$row[cnt] |
";
$article_num--;
}
?>
:::::::::::::::::::::::::
view.html
À§Ä¡:
±Û¾´³¯Â¥ |
|
Á¢¼ÓIP |
|
if($mode=="search"){
?>
°Ë»ö¸®½ºÆ®
}
?>
¸®½ºÆ®
>¼ö Á¤
:::::::::::::::::::::::::::::::::::
-°ü·Ã¼Ò½º Àüüº¸±â
ÆÄÀϸí: list.html
New Document
MyBoard ver 1.0
¹ø È£ |
Á¦ ¸ñ |
ÀÌ ¸§ |
µî·Ï³¯Â¥ |
Á¶È¸¼ö |
include "connect.php";
$query="select count(*) from board1";
$result=mysql_query($query);
$total_record=mysql_result($result,0,0);
$num_per_page=5; //ÆäÀÌÁö³ª´©±â***
$total_page=ceil($total_record/$num_per_page);
//ÆäÀÌÁö³ª´® *½ÃÀÛ
if(!$page){$page=1;}//ÆäÀÌÁöº¯¼öÃʱâÈ
$first=($page-1) * $num_per_page;
// (1-1)*10 (2-1)*10 (3-1)*10
//0,10,20,30
//ÀÚµ¿¼ø¼·ÎÃâ·ÂÇϱâ
$article_number=$total_record-$first;
$query="select * from board1 order by num desc limit $first,$num_per_page";
$result=mysql_query($query);
while($row=mysql_fetch_array($result)){
$subject=stripslashes($row[subject]);
echo "
$article_number |
$subject |
$row[name] |
$row[reg_date] |
$row[cnt] |
";
$article_number--;// $atricle_number=$article_number-1;
}
?>
/*
for($i=1;$i<=$total_page;$i++){
echo "[$i]";
}
*/
?>
//
//
$num_per_block=5; //ºí·°³ª´©±â***
$total_block=ceil($total_page/$num_per_block); //ÅäÅ»ÆäÀÌÁö
$block=ceil($page/$num_per_block); //ÇöÀçºí·°
// 23/10=2.3 ->3
$first_page=$num_per_block *($block-1);//ù ³¡ÆäÀÌÁö°ª±¸ÇÔ
$last_page=$num_per_block * $block; //¸¶Áö¸·ÆäÀÌÁö
if($block>=$total_block){
$last_page=$total_page;
}
//echo "block --- $block
";
//echo "total_block --- $total_block
";
//echo "total_page --- $total_page
";
if($block>=$total_block){
$prev=$first_page;
echo "[óÀ½]";
echo "[ÀÌÀü]";
}
for($go_page=$first_page+1;$go_page<=$last_page;$go_page++){
//ºí·°ÆäÀÌÁö¼ö Ä®¶ó&Å©±â º¯°æ *½ÃÀÛ
if($go_page==$page){
echo "[$go_page]";//go_page:ÇöÀçÆäÀÌÁö
}else{
echo "[$go_page]";
}
//ºí·°ÆäÀÌÁö¼ö Ä®¶ó&Å©±â º¯°æ *³¡
}
if($block<$total_block){
$next=$last_page+1;
echo "[´ÙÀ½]";
echo "[¸¶Áö¸·]";
}
?>
±Û¾²±â
:::::::::::::::::::::::::::::::::
ÆÄÀϸí: search.html
New Document
//ÆÄÀϸí: search.html
echo "choice --- $choice
";
echo "search --- $search
";
$query="select * from board1 ";//°ø¹é "
$endquery=" order by num desc";//" °ø¹é
if($choice == "name"){
$fullquery=$query . "where name='$search'" . $endquery;
}else if($choice == "subject") {
$fullquery=$query . "where subject like '%$search%'" . $endquery;
}else if($choice == "content") {
$fullquery=$query . "where content like '%$search%'" . $endquery;
}
include "connect.php";
$result=mysql_query($fullquery);
$article_num=mysql_num_rows($result);//°Ë»ö½Ã ¼ø¼¸¦ 1¹øºÎÅÍ Ãâ·Â
echo "°Ë»öµÈ °Ô½Ã¹° °¹¼ö --- $article_num
";//°Ë»ö½Ã Ãâ·ÂµÈ°¹¼öÆľÇ
?>
°Ë»öµÈ °Ô½Ã¹°
°¹¼ö |
¹øÈ£ |
À̸§ |
Á¦¸ñ |
µî·Ï³¯Â¥ |
Á¶È¸¼ö |
while($row=mysql_fetch_array($result)){
echo "
$article_num |
$row[subject] |
$row[num] |
$row[name] |
$row[subject] |
$row[reg_date] |
$row[cnt] |
";
$article_num--;
}
?>
ÀÌÀü
::::::::::::::::::::::::::::::::
ÆÄÀϸí: view.html
echo "³Ñ¾î¿Â ±Û¹øÈ£ --- $num
";
include "connect.php";
//Á¶È¸¼ö Áõ°¡
$query="update board1 set cnt=cnt+1 where num='$num'";
$result=mysql_query($query);
$query="select * from board1 where num='$num'";
$result=mysql_query($query);
$row=mysql_fetch_array($result);
$content=nl2br($row[content]);
?>
ÀÌ ¸§ |
= "$row[name]";?> |
Á¶È¸¼ö |
= "$row[cnt]";?> |
À̸ÞÀÏ |
|
ȨÆäÀÌÁö |
|
Á¦ ¸ñ |
|
|
±Û¾´³¯Â¥ |
|
Á¢¼ÓIP |
|
if($mode=="search"){
?>
°Ë»ö¸®½ºÆ®
}
?>
¸®½ºÆ®
>¼ö Á¤
>»è Á¦