Hi, just after some advice on the best way to go about the final part of my db design.
at the moment I have a movies table:
movies (
‘movie_id’ INT,
‘movie_name’ VARCHAR(255),
‘movie_genreid’ INT,
‘movie_region’ CHAR(3),
‘release_date’ DATE
) DEFAULT CHARSET utf8
and a users table:
users (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(55) UNIQUE,
email VARCHAR(55) UNIQUE,
password CHAR(32)
) DEFAULT CHARACTER SET utf8
I have thousands of movies in the movies table and I have an addmovie.php form that allows users to search for the movies.
I want users to be able to add movies from their searches to their own user page (users.php?user=username).
I’m just wondering on the best database design for this… should I just make a ‘usermovies’ table to link to the movies table? and then just add every users selected movies to the usermovies table? ie
your suggestion sounds right. As far as I know there is no other (good) way to do it.
You want to put an index on the userId column to allow for faster loading of the user pages.
And of course the combination userId, movieId should be UNIQUE.