So I am trying to create a blog in php and mysql. I am not sure how this is going to work out there. Just let me know if i am on the right track with the DB.
Let's say i have database called blog with table user and posts. This is for multiuser blog. So I want to connect userid with the posts table. So I need to make userid field common in both tables right?
e.g.
create table users (
id int auto_increment primary key,
userid int NOT NULL,
password varchar(40) NOT null,
)
create table posts(
id int auto increment primary key,
userid not null,
post_header varchar(400) NOT NULL,
post_body text NOT NULL)
foreign key userid reference users(userid);
Is this a right approach ? Also I am thinking about making procedural way of accessing data with mysqli. Is there anything wrong with procedural approach?