Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.