PHP 프로그래밍

본문 바로가기
사이트 내 전체검색


PHP 프로그래밍
PHP 프로그래밍

4. 게시판 목록 수정(1)

페이지 정보

작성자 관리자 댓글 0건 조회 519회 작성일 22-01-13 21:04

본문

4. 게시판 목록 수정(1)

파일 : index.php


<?php

    require_once("./dbConnect.php");

?>

<!DOCTYPE html>

<html>

    <head>

        <title>게시판</title>

        <meta charset="UTF-8">

        <meta name="viewport" content="width=device-width, initial-scale=1.0">

         <link rel="stylesheet" href="./css/style1.css"/>

   </head>

    <body>

        <article class="boardArticle">

          <div id="list">

            <h3>반응형 게시판 </h3>

            <table>                

                <thead>

                    <tr>

                        <th scope="col" class="no"> 번호</th>

                        <th scope="col" class="subject">제목</th>

                        <th scope="col" class="author">작성자</th>

                        <th scope="col" class="date">작성일</th>

                        <th scope="col" class="hit">조회</th>

                    </tr>

                </thead>

                <tbody>

<?

$sql = 'select * from bbs order by b_no desc'; 

// 최근에 작성된 글이 맨위로 올라온다.

$result = $db->query($sql);

while($row=$result->fetch_array()){

$datetime = explode(' ', $row['b_date']); // 시간과 날짜를 나눈다.

$date = $datetime[0]; //년월일

$time = $datetime[1]; //시분초

if($date == Date('Y-m-d'))

$row['b_date'] = $time;

else

$row['b_date'] = $date;   

?>

                    <tr>

                        <td class="no"><?=$row['b_no']?></td>

                        <td class="subject"><a href="./view.php?no=<?=$row['b_no']?>"><?=$row['b_subject']?></a></td>

                        <td class="author"><?=$row['b_id']?></td>

                        <td class="date"><?=$row['b_date']?></td>

                        <td class="hit"><?=$row['b_hit']?></td>

                    </tr>

<?php

}

?>                    

                </tbody>

            </table>

            <div class="btnSet">

                <a href="./write.php" class="btnWrite">글쓰기</a>

            </div>

          </div>  

        </article>

    </body>

</html>



11.PNG









댓글목록

등록된 댓글이 없습니다.


개인정보취급방침 서비스이용약관 모바일 버전으로 보기 상단으로

TEL. 063-469-4551 FAX. 063-469-4560 전북 군산시 대학로 558
군산대학교 컴퓨터정보공학과

Copyright © www.leelab.co.kr. All rights reserved.