Jump to content

query of multiple user tags help


Convictions

Recommended Posts

First, thank you for taking the time to read this.

 

I have a table named `Tags` which consists of my site members tags (words stripped from their about me sections) - this table has two columns: Tag, profile.

Tag is the word, profile is the ID of the member.

 

I am trying to have a query that outputs a member's tags that at least matches one other member's tag in the database.  I have tried everything I can think of.  Here is my code, and error generated:

 

        $sTagsQuery = "SELECT `Tag` as `user_tag` FROM `Tags` WHERE `Tags`.`profile`='{$p_arr['ID']}' AND EXISTS

                      (SELECT `Tag` FROM `Tags` WHERE `Tag` = `user_tag` AND COUNT( `Tags`.`Tag` ) > 2 GROUP BY `Tags`.`Tag`)";

        $rTags = db_res( $sTagsQuery );

        while( $aTags = mysql_fetch_assoc( $rTags ) )

        {

        $sTagsAddon .= "<a href='" . $site['url'] . "search_result.php?tag=" . $aTags['user_tag'] . "'>" . $aTags['user_tag'] . "</a>, ";

        }

 

 

The error is:

 

Query:

SELECT `Tag` as `user_tag` FROM `Tags` WHERE `Tags`.`profile`='1' AND EXISTS

        (SELECT `Tag` FROM `Tags` WHERE `Tag` = `user_tag` AND COUNT( `Tags`.`Tag` ) > 2 GROUP BY `Tags`.`Tag`)

 

Mysql error:

Invalid use of group function

 

 

Any help will be greatly appreciated!

Thank you,

Chris

www.convictionscommunity.com

Link to comment
https://forums.phpfreaks.com/topic/98458-query-of-multiple-user-tags-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.