A database is your app's memory bank. You need it to store things like user accounts, products, orders, posts, comments, and settings. By connecting PHP with MySQL/MariaDB, you can build dynamic websites. In this tutorial, to keep things beginner-friendly, MySQLi is used, with an emphasis on prepared statements.
php
-- Example table structure
CREATE TABLE contacts (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
email VARCHAR(150) NOT NULL,
message TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);You should see
A contacts table gets created in the database, ready to store form submissions.