I have an mp3 downloading site and I want to create a search page, but I am in simple confusion. I have two tables, one that stores movie details like movie name
and movie cast
, and another one where all the songs of movies are stored. The structure of two tables is shown below:
Table 1: name categories
column :5
id,cat,cast,year,type
here id is primary key
cat is album/movie name
cast is all actores details of movie
year is releasing year and type is movie type
Table 2: files
column :4
id,cat,preview,file
Here my user can search with any keywords, and I can extract rows by sql query but here are two tables so I am confused what to do? The user can input previews from table
and can enter cat, type, cast, type and year from table 1
.
Your table structure is not clear, But using join in query is not that complicated as you think, try and learn. Good luck
SELECT Category.cat, Category.cast, Category.year, Category.Type, File.preview, File.file
FROM category As Category
LEFT JOIN files As File On Category.cat = File.cat
WHERE Category.cat LIKE '%search%' OR Category.cast LIKE '%search%'
OR File.preview LIKE '%search%'
etc