I'm trying to get results from a mysql database based on values in an array.
My tables look like this
id | articles | thumbs | etc
tag_id | tag_name | article_id
I'd like to get related articles based on the tags for that particular article. So if an article has books, drawings, cartoons for tags, then I would like to get articles from the database that have those exact tags, only.
I have this query below which gets related articles if an article has ONE or MORE of the tags associated with it.
$tagcom=array("books","drawings","cartoons"); $tagcoms = implode("', '", $tagcom); $query = mysql_query("SELECT DISTINCT id,articles,thumb FROM articles,tags WHERE tags.tag_name IN ('$tagcoms') AND id != '$articleid'") or die(mysql_error());
How would I construct this to get related articles that only have the $tagcom array values. Not articles with more tags or less tags?
Thanks a lot :)