@charset "utf-8";
/* 전체 옵션 */
*{
margin:0 auto;
padding:0;
font-family: 'Malgun gothic', 'Sans-Serif','Arial';
}
a{
text-decoration: none;
columns:#333;
}
ul li {
list-style:none;
}
#wrap{
width:800px;
position: relative;
}
#board_list{
position: absolute;
left:30px;
font-size:14px;
top:90px;
line-height: 30px;
}
<?php
include "header.php";
include "/board/db.php";
echo "PHP 테스트"
?>
<!-- body 시작부분 -->
<div id="wrap">
<div id="header">
<div>
<h3>홍길동님 환영합니다! </h3>
</div>
<div>
<form action="/board/login_ok.php" method="post">
<ul>
<li><input type="text" name="userid" placeholder="아이디" require></li>
<li><input type="text" name="userpw" placeholder="비밀번호" require></li>
<li><input type="submit" value="로그인"></li>
<li><a href="/board/join_form.php">회원가입하기 </a></li>
</ul>
</form>
</div>
</div>
<div id="board_list">
<table class="list_table">
<thead>
<tr>
<th width="70">번호</th>
<th width="100">제목</th>
<th width="120">글쓴이</th>
<th width="100">작성일</th>
</tr>
</thead>
<tbody>
<!-- 최대 10개 -->
<tr>
<td>0</td>
<td>타이틀입니다.</td>
<td>hong</td>
<td>2019.11.25</td>
</tr>
<tr>
<td>1</td>
<td>타이틀입니다.</td>
<td>hong2</td>
<td>2019.11.25</td>
</tr>
</tbody>
</table>
<div id="write_btn">
<a href="/board/write.php"><button>글쓰기</button></a>
</div>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>실습용 게시판 </title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<!-- include 하는 php에서 쓴다
</body>
</html>
-->
<?php
//db.php
session_start();
// 공백 대소문자 완전 똑같이
header('Content-Type: text/html : charset=utf-8');
// db 이름
$db=new mysqli("localhost","root","111111","level_board")
if($db->connect_errno){
echo "Failed to connect to MySQL : " . $db->connect_errno;
exit;
}
function req_query($sql){
global $db;
return $db ->query($sql); // 쿼리 결과를 리턴함
}
?>