list.html À§Ä¡:Ãß°¡¸ñ·Ï-ºí·°ÆäÀÌÁö¼ö Ä®¶ó&Å©±â º¯°æ for($go_page=$first_page+1;$go_page<=$last_page;$go_page++){ //ºí·°ÆäÀÌÁö¼ö Ä®¶ó&Å©±â º¯°æ *½ÃÀÛ if($go_page==$page){ echo [<a href=list.html?page=$go_page><font color=red><b>$go_page</b></font></a>];//go_page:ÇöÀçÆäÀÌÁö }else{ echo [<a href=list.html?page=$go_page>$go_page</a>]; } //ºí·°ÆäÀÌÁö¼ö Ä®¶ó&Å©±â º¯°æ *³¡ }
search.html À§Ä¡:ÀÚ·á°Ë»öÈÄ ¸µÅ©¿¬°á <? while($row=mysql_fetch_array($result)){ echo <tr> <td>$article_num</td> <td><a href=view.html?num=$row[num]&mode=search>$row[subject]</a></td> <td>$row[num]</td> <td>$row[name]</td> <td>$row[subject]</td> <td>$row[reg_date]</td> <td>$row[cnt]</td> </tr>; $article_num--; } ?>
::::::::::::::::::::::::: view.html À§Ä¡: <tr> <td>±Û¾´³¯Â¥</td> <td><?echo $row[reg_date];?> </td> <td>Á¢¼ÓIP</td> <td><?echo $row[userip];?> </td> </tr> </table> <br>
<? if($mode==search){ ?> <a href=javascript:history.back();> °Ë»ö¸®½ºÆ®</a>
<? } ?> <a href=list.html>¸®½ºÆ®</a> <a href=modifycheck.html?num=<?echo $num;?>>¼ö Á¤</a>
:::::::::::::::::::::::::::::::::::
-°ü·Ã¼Ò½º Àüüº¸±â ÆÄÀϸí: list.html <HTML> <HEAD> <style type= ext/css>
<link rel=stylesheet type= ext/css href=my.css>
a {text-decoration:none;} .my1 {font-weight: bold; color:olive;} </style> <TITLE> New Document </TITLE>
</HEAD>
<BODY> <br> <font color=#006666 size=5> MyBoard ver 1.0 </font> <br> <table border=1 width=700>
<tr> <td>¹ø È£</td> <td>Á¦ ¸ñ</td> <td>ÀÌ ¸§</td> <td>µî·Ï³¯Â¥</td> <td>Á¶È¸¼ö</td> </tr> <? 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 <tr> <!--<td>$row[num]</td>--> <td>$article_number</td> <td><a href=view.html?num=$row[num]>$subject</a></td> <td>$row[name]</td> <td>$row[reg_date]</td> <td>$row[cnt]</td> </tr>; $article_number--;// $atricle_number=$article_number-1; } ?>
<!-- <tr> <td></td> <td><?echo $row[reg_date];?> </td> <td>Á¢¼ÓIP</td> <td><?echo $row[userIp];?> </td>
</tr> -->
</table> <br>
<!--ÆäÀÌÁö³ª´® *½ÃÀÛ --> <?
/* for($i=1;$i<=$total_page;$i++){ echo [<a href=list.html?page=$i>$i</a>]; } */ ?>
<?
//<!--ÆäÀÌÁö³ª´® *³¡ -->
//<!--ÆäÀÌÁöºí·°³ª´® *½ÃÀÛ -->
$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 lock --- $block<br>; //echo otal_block --- $total_block<br>; //echo otal_page --- $total_page<br>;
if($block>=$total_block){ $prev=$first_page;
echo [<a href=list.html?page=1>óÀ½</a>]; echo [<a href=list.html?page=$prev>ÀÌÀü</a>]; }
for($go_page=$first_page+1;$go_page<=$last_page;$go_page++){ //ºí·°ÆäÀÌÁö¼ö Ä®¶ó&Å©±â º¯°æ *½ÃÀÛ if($go_page==$page){ echo [<a href=list.html?page=$go_page><font color=red><b>$go_page</b></font></a>];//go_page:ÇöÀçÆäÀÌÁö }else{ echo [<a href=list.html?page=$go_page>$go_page</a>]; } //ºí·°ÆäÀÌÁö¼ö Ä®¶ó&Å©±â º¯°æ *³¡ }
if($block<$total_block){ $next=$last_page+1; echo [<a href=list.html?page=$next>´ÙÀ½</a>];
echo [<a href=list.html?page=$total_page>¸¶Áö¸·</a>]; }
?>
<a href=write.html><!--img src=http://www.pcall.co.kr/img/90.gif border=0 width=70 height=50-->±Û¾²±â</a> <!--°Ë»öÁ¶È¸1213 *½ÃÀÛ--> <br><hr> <form method=post action=search.html> <select name=choice> <option value=name>À̸§ <option value=subject>Á¦¸ñ <option value=content>³»¿ë </select> <input type=text name=search> <input type=submit value=Àü¼Û> </form> <!--°Ë»öÁ¶È¸1213 *³¡--> </BODY> </HTML>
::::::::::::::::::::::::::::::::: ÆÄÀϸí: search.html <!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN> <HTML> <HEAD> <TITLE> New Document </TITLE> </HEAD>
<BODY> <br> <? //ÆÄÀϸí: search.html echo choice --- $choice<br>; echo search --- $search<br>;
$query=select * from board1 ;//°ø¹é $endquery= order by num desc;// °ø¹é
if($choice ==
ame){ $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<br>;//°Ë»ö½Ã Ãâ·ÂµÈ°¹¼öÆľÇ
?> <font size=5 color=#ff0000>°Ë»öµÈ °Ô½Ã¹°</font> <table border=1 width=700> <tr> <td>°¹¼ö</td> <td>¹øÈ£</td> <td>À̸§</td> <td>Á¦¸ñ</td> <td>µî·Ï³¯Â¥</td> <td>Á¶È¸¼ö</td> </tr> <? while($row=mysql_fetch_array($result)){ echo <tr> <td>$article_num</td> <td><a href=view.html?num=$row[num]&mode=search>$row[subject]</a></td> <td>$row[num]</td> <td>$row[name]</td> <td>$row[subject]</td> <td>$row[reg_date]</td> <td>$row[cnt]</td> </tr>; $article_num--; } ?> </table> <br> <a href=javascript:history.back();>ÀÌÀü</a> </BODY> </HTML>
:::::::::::::::::::::::::::::::: ÆÄÀϸí: view.html <html> <body> <br> <br> <? echo ³Ñ¾î¿Â ±Û¹øÈ£ --- $num<br>; 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]); ?> <table border=1 width=700> <tr> <td>ÀÌ ¸§</td> <td><?= $row[name];?> </td> <td>Á¶È¸¼ö</td> <td><?= $row[cnt];?> </td> </tr> <tr> <td>À̸ÞÀÏ</td> <td><?echo $row[email];?> </td> <td>ȨÆäÀÌÁö</td> <td><?echo $row[hpage];?> </td> </tr> <tr> <td>Á¦ ¸ñ</td> <td colspan=3><?echo $row[subject];?> </td> </tr> <tr> <td colspan=4 height=200> <?echo $content;?> </td> </tr> <tr> <td>±Û¾´³¯Â¥</td> <td><?echo $row[reg_date];?> </td> <td>Á¢¼ÓIP</td> <td><?echo $row[userip];?> </td> </tr> </table> <br>
<? if($mode==search){ ?> <a href=javascript:history.back();> °Ë»ö¸®½ºÆ®</a>
<? } ?> <a href=list.html>¸®½ºÆ®</a> <a href=modifycheck.html?num=<?echo $num;?>>¼ö Á¤</a> <a href=deletecheck.html?num=<?echo $num;?>>»è Á¦</a>
<hr color=orange align=left width=700> <form method=post action=memoinput.php?num=<?echo $num;?>> <table border=1 width=700> <tr> <td width=150>ÀÌ ¸§</td> <td><input type=text name=memoname></td>
<td width=150>ºñ¹Ð¹øÈ£</td> <td><input type=password name=memopass></td> </tr>
<tr> <td width=150>¸Þ ¸ð</td> <td colspan=2><input type=text name=memo size=60></td> <td><input type=submit value=ÀÔ·Â></td> </tr> </table>
<br> <table border=1 width=700> <tr> <td>ÀÌ ¸§</td> <td>¸Þ ¸ð</td> <td>»è Á¦</td> </tr>
<? $query=select * from memo where pid=$num order by step asc; $result=mysql_query($query);
while($row=mysql_fetch_array($result)){ echo <tr> <td>$row[memoname]</td> <td>$row[memo]</td> <td><a href=memodelcheck.html?num=$num&step=$row[step]>»èÁ¦</a></td> </tr>; } ?>
<!--//$query=select * from memo where pid=$num order by step desc;--> </table> </body> </html>
PHP½ºÅ͵ð 2004 12 14
¼Ò½ºÀÚ¼¼È÷ Á¤È®ÇÏ°Ôº¸±â (´õÀÚ¼¼È÷´Â ÇØ´ç¹®¼¿¡¼ ¿À¸¥Âʸ¶¿ì½º·Î ¼Ò½ºº¸±âÇϼ¼¿ä) http://www.6VJ.com/php/php1214.txt
|