1. Overview
Using PHP and MySQL, you can build a simple bulletin board (notice board) from scratch. This article walks through the basic structure and implementation of one.
2. Basic File Structure
A bulletin board consists of the following pages:
notice.php — Post list
write.php — Write a new post
save_notice.php — Save the post to the database
view.php — View post details
3. Creating the Database Table
sqlCREATE TABLE notices (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255),
content TEXT,
username VARCHAR(100),
views INT DEFAULT 0,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
4. Post List Page
php$result = $conn->query("SELECT * FROM notices ORDER BY id DESC");
while ($row = $result->fetch_assoc()) {
echo "<a href='view.php?id=" . $row['id'] . "'>" . $row['title'] . "</a>";
}
5. Write Post Page
html<form action="save_notice.php" method="post">
<input name="title" placeholder="Title">
<textarea name="content"></textarea>
<button type="submit">Submit</button>
</form>
6. Save Post to Database
php$stmt = $conn->prepare("
INSERT INTO notices (title, content, username)
VALUES (?, ?, ?)
");
7. View Post Details
sqlSELECT * FROM notices WHERE id = ?
8. Summary
A bulletin board operates on a CRUD structure (Create, Read, Update, Delete)
The core of the system is the PHP and MySQL integration
Combining it with a login system greatly increases its usefulness and security
💡 Pro Tip
A bulletin board is one of the most fundamental features of any website. Mastering it gives you a solid foundation for building more complex web applications.
Login with Google