cheapbag214s
Joined: 27 Jun 2013
Posts: 17953
Read: 0 topics
Warns: 0/5 Location: England
|
Posted: Fri 15:48, 16 Aug 2013 Post subject: Articles which contain favored tags-spun1 |
|
|
Articles which contain favored tags,[link widoczny dla zalogowanych]
Now I want to give the user the opportunity to add tags to his "favored tags list",[link widoczny dla zalogowanych]. Then the user should only see news articles which contain one of the favored tags,[link widoczny dla zalogowanych].
Assuming the user Bob has favored the tags "barack obama",[link widoczny dla zalogowanych], "nba",[link widoczny dla zalogowanych], "new jersey" and "dogs". He should only see articles containing at least one of these four tags.
How could I code a PHP/MySQL script which achieves this? I think my database structure is not adequate for this purpose,[link widoczny dla zalogowanych], is it? I would have to make DB queries like this:
"SELECT * FROM news WHERE id IN (SELECT article FROM tags WHERE tag IN ('barack obama',[link widoczny dla zalogowanych], 'nba',[link widoczny dla zalogowanych], 'new jersey',[link widoczny dla zalogowanych], 'dogs'))"
This query would run for a long time,[link widoczny dla zalogowanych], wouldn't it? There must be a database structure which is more appropriate than mine. Do you have an idea for this problem? Which DB structure do I need and what queries must I use then?
相关的主题文章:
[link widoczny dla zalogowanych]
[link widoczny dla zalogowanych]
[link widoczny dla zalogowanych]
[link widoczny dla zalogowanych]
[link widoczny dla zalogowanych]
[link widoczny dla zalogowanych]
[link widoczny dla zalogowanych]
[link widoczny dla zalogowanych]
[link widoczny dla zalogowanych]
[link widoczny dla zalogowanych]
The post has been approved 0 times
|
|