> For the complete documentation index, see [llms.txt](https://westsilver.gitbook.io/study-script/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://westsilver.gitbook.io/study-script/php/php-mysql/undefined-1.md).

# 게시판

## 게시판(Board)

{% hint style="info" %}

### 게시판 파일생성

**create**/createBoard.php, createBoardData.php

**board**/board.php, boardModify.php, boardModifySave.php, boardRemove.php, boardSearch.php, boardView\.php, boardWrite.php, boardWriteSave.php
{% endhint %}

### 게시판 TABLE 생성

&#x20; 1\. create/createBoard.php

```php
<?php
	include '../connect/connect.php';

	$sql = "CREATE TABLE studyBoard (";
	$sql .= "studyBoardID int(10) unsigned NOT NULL AUTO_INCREMENT,";
	$sql .= "studyMemberID int(10) unsigned NOT NULL,";
	$sql .= "boardTitle varchar(50) NOT NULL,";
	$sql .= "boardContent longtext NOT NULL,";
	$sql .= "boardView int(10) unsigned NOT NULL,"; 
	$sql .= "regTime int(15) unsigned NOT NULL,";
	$sql .= "PRIMARY KEY (studyBoardID)) CHARSET=utf8";

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

	if($result){
		echo "Create Board Complete";
	} else {
		echo "Create Board False";
	}
?>
```

&#x20;  2\. board.php

{% file src="/files/-Ml0iqPB\_62XAHF0cCFO" %}

&#x20;  3\. boardWrite.php

{% file src="/files/-Ml0hmcggMLeQ0xb3NG5" %}

&#x20;  4\. boardWriteSave.php

```php
<?php
    include "../connect/connect.php";
    include "../connect/session.php";
    include "../connect/sessionCheck.php";

    $boardTitle = $_POST['boardTitle'];
    $boardContent = $_POST['boardContent'];

    $boardTitle = $connect -> real_escape_string($boardTitle);
    $boardContent = $connect -> real_escape_string($boardContent);
    $boardView = 0;
    $regTime = time();
    $memberID = $_SESSION['studyMemberID'];
    
    $sql = "INSERT INTO studyBoard(studyMemberID, boardTitle, boardContent, boardView, regTime) VALUES('$memberID', '$boardTitle', '$boardContent', '$boardView', '$regTime')";
    $result = $connect -> query($sql);

    // if($result){
    //     echo "good";
    // } else {
    //     echo "bad";
    // }
?>
<script>
    location.href="board.php";
</script>

```

&#x20;  5\. board.php 파일에 **게시 목록 보여주기** 및 **클릭시 게시글 보여주기**

```php
<?php
    $sql = "SELECT b.studyBoardID, b.boardTitle, m.youName, b.boardView, b.regTime FROM studyBoard b JOIN studyMember m ON (m.studyMemberID = b.studyMemberID) ORDER BY studyBoardID";
    $result = $connect -> query($sql);

    if($result){
        $count = $result -> num_rows;

        if($count > 0){
            for($i=1; $i<=$count; $i++){
                $boardInfo = $result -> fetch_array(MYSQLI_ASSOC);
                echo "<tr>";
                echo "<td>".$boardInfo['studyBoardID']."</td>";
                echo "<td><a href='boardView.php'>".$boardInfo['boardTitle']."</a></td>";
                echo "<td>".$boardInfo['youName']."</td>";
                echo "<td>".date('Y-m-d', $boardInfo['regTime'])."</td>";
                echo "<td>".$boardInfo['boardView']."</td>";
                echo "</tr>";
            }
        }
    }
?>
```

{% hint style="info" %}
\<td> 태그는 HTML 테이블에서 하나의 데이터 셀(data cell)을 정의할 때 사용

* **\<tr>요소는 하나 이상의  \<th>요소(data cell)나  \<td>요소(header cell)를 포함**

HTML 테이블를 구성하는 셀(cell)은 두 종류로 구분할 수 있으며, 하나는  \<th>요소를 사용한 헤더 정보를 저장하는 헤더 셀과 또 다른 하나는  \<td>요소를 사용한 일반적인 데이터를 저장하는 데이터 셀로 구분 됨

* **\<th>**&#xC694;소 내의 텍스트는 기본적으로 굵은 폰트로 중앙 정렬
* **\<td>**&#xC694;소 내의 텍스트는 일반적인 두께의 폰트로 좌측 정렬
* colspan 속성과 rowspan 속성을 사용하면 콘텐츠를 여러 셀에 걸쳐 나타낼 수 있음
  {% endhint %}

{% hint style="warning" %}

### 엘리엇?

ex) \<?php $sql = "SELECT b.studyBoardID, b.boardTitle, m.youName" ?>

b 와 m 은  데이터를 불러올 엘리엇임
{% endhint %}

{% hint style="info" %}
echo "\<td>".date('Y-m-d h; s;', $boardInfo\['regTime'])."\</td>";

h 와 s는 시간과 초를 나타냄
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://westsilver.gitbook.io/study-script/php/php-mysql/undefined-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
