Answer the question
In order to leave comments, you need to log in
Sql query "Related materials"?
Task:
There are 2 tables:
1) torrents, (there are columns like "id, name, image, genre)
2) tags (id,name)
The tag name in the tags table and the genre column from the torrents is identical.
The $tags variable stores all the title tag about the current release
Sort similar releases by tags
So that the query searches from two existing tags in the current distribution and shows 10 suitable options with pictures and with the name of the movie (sql query will be enough) I can display the result itself thanks in advance
Answer the question
In order to leave comments, you need to log in
Solved the problem on my own!
$sql = $db->query($query);
$arr = $db->get_row($sql
$genre = explode(',', $arr['genre']);
$query = "SELECT id, image, name, genre FROM `torrents` WHERE genre LIKE '%".$genre[1]."%' OR '%".$genre[2]."%' LIMIT 10";
Your Russian language is apparently not native. Let's assume that I understand you.
SELECT what you need FROM torrents as to
INNER JOIN tags as ta ON ta.id = to.genre
WHERE ta.name = something
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question