You will need 4 tables, user , movie , genre and / p>
I used it as a reference
link
The user links one-to-many in watched movies, movies from 1 to multiple movies watched, genre 1 to multiple movies watched.
The mysql code looks like this:
CREATE TABLE Usuario (
id INT NOT NULL,
nome VARCHAR(45) NOT NULL,
//OUTROS DADOS DO USUARIO
PRIMARY KEY(id)
);
CREATE TABLE FilmeVistos(
id INT NOT NULL,
FOREIGN KEY (idUsuario) REFERENCES Usuario(id),
FOREIGN KEY (idFilme) REFERENCES Filmes(id)
);
CREATE TABLE Filmes (
id INT NOT NULL,
nome VARCHAR(45) NOT NULL,
//OUTROS DADOS DO Filme
PRIMARY KEY(id),
FOREIGN KEY (idGenero) REFERENCES Genero(id)
);
CREATE TABLE Genero (
id INT NOT NULL,
nome VARCHAR(30) NOT NULL,
//OUTROS DADOS DO Genero
PRIMARY KEY(id)
);
//apareça os filmes cadastrados
SELECT * FROM Filmes;
Put this select in a field for the user to tag and insert into the Viewed Movies.
Any questions see the link below to connect to the bank with php.
link