How to create a blog in PHP and MySQL database - DB design
The Database This is the second part in a series on How To Create A Blog with PHP and MySQL. You can get the first part here We will continue where we left off in the last tutorial. In this section we will be working on our database design and user authentication (registration and login). Create a database named complete-blog-php . In this database, create 2 tables: posts and users with the following fields. You can create these tables using these commands. users : CREATE TABLE `users` ( `id` int(11) AUTO_INCREMENT PRIMARY KEY NOT NULL, `username` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `role` enum('Author','Admin') DEFAULT NULL, `password` varchar(255) NOT NULL, `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; posts : CREATE TABLE `posts` ( `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `user_id` int(11) DEFAULT NULL, `title` varchar(255) NOT N