Jump to content


Photo

SELECT fulltext problems...


  • Please log in to reply
7 replies to this topic

#1 Hilly_2004

Hilly_2004
  • Members
  • PipPipPip
  • Advanced Member
  • 63 posts

Posted 10 March 2006 - 01:44 PM

Hey guys,

Wondered if you could help me, Im doing a full text search and my select statement looks like this:

        $sql = "SELECT Submissions.Submission_ID, Submissions.Conference_ID, Submissions.Subject_ID, Submissions.Title, Submissions.Summary, Submissions.Keywords, Submissions.Timestamp, forum_members.M_FIRSTNAME, forum_members.M_SURNAME, forum_members.M_NAME, forum_members.MEMBER_ID 
        
               MATCH(Submissions.Title, Submissions.Summary, Submissions.Keywords)
               AGAINST ('$searchstring') AS score FROM Submissions LEFT JOIN forum_members on Submissions.MEMBER_ID = forum_members.MEMBER_ID
               
               WHERE MATCH(Submissions.Title, Submissions.Summary, Submissions.Keywords)
               AGAINST ('$searchstring') ORDER BY score DESC";

Problem is I only want it to select the current conference (which is stored in a variable called $CurrentConfID). So normally I would put "WHERE Submissions.Conference_ID = '$CurrentConfID'" somewhere in there but it doesn't seem to work anywhere I put it, any help?

#2 Hilly_2004

Hilly_2004
  • Members
  • PipPipPip
  • Advanced Member
  • 63 posts

Posted 10 March 2006 - 08:14 PM

Please?

#3 Hilly_2004

Hilly_2004
  • Members
  • PipPipPip
  • Advanced Member
  • 63 posts

Posted 10 March 2006 - 10:07 PM

Sorry guys, don't want to seem like Im being annoying but any help whatsoever would be really really good.

#4 Hilly_2004

Hilly_2004
  • Members
  • PipPipPip
  • Advanced Member
  • 63 posts

Posted 11 March 2006 - 02:02 AM

[img src=\"http://www.phpfreaks.com/forums/style_images/1/folder_post_icons/icon9.gif\" border=\"0\" alt=\"IPB Image\" /]

#5 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 11 March 2006 - 02:54 AM

Try this:

[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] Submissions.Submission_ID,
Submissions.Conference_ID,
Submissions.Subject_ID,
Submissions.Title,
Submissions.Summary,
Submissions.Keywords,
Submissions.Timestamp,
forum_members.M_FIRSTNAME,
forum_members.M_SURNAME,
forum_members.M_NAME,
forum_members.MEMBER_ID
MATCH(Submissions.Title, Submissions.Summary, Submissions.Keywords) AGAINST ('$searchstring') AS score
FROM Submissions LEFT JOIN forum_members on Submissions.MEMBER_ID = forum_members.MEMBER_ID
WHERE MATCH(Submissions.Title, Submissions.Summary, Submissions.Keywords) AGAINST ('$searchstring') AND Submissions.Conference_ID = '$CurrentConfID'
ORDER BY score DESC [!--sql2--][/div][!--sql3--]

#6 Hilly_2004

Hilly_2004
  • Members
  • PipPipPip
  • Advanced Member
  • 63 posts

Posted 11 March 2006 - 03:18 PM

Thanks for the reply but thats not working, the error I get is:

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'MATCH(Submissions.Title, Submissions.Summary, Submissions.Keywo......

#7 Hilly_2004

Hilly_2004
  • Members
  • PipPipPip
  • Advanced Member
  • 63 posts

Posted 11 March 2006 - 03:39 PM

Im getting there....Ive changed it to:

        $sql = "SELECT Submissions.Submission_ID, Submissions.Conference_ID, Submissions.Subject_ID, Submissions.Title, Submissions.Summary, Submissions.Keywords, Submissions.Timestamp, forum_members.M_FIRSTNAME, forum_members.M_SURNAME, forum_members.M_NAME, forum_members.MEMBER_ID 
FROM Submissions LEFT JOIN forum_members on Submissions.MEMBER_ID = forum_members.MEMBER_ID
   
WHERE Submissions.Conference_ID = '$CurrentConfID' AND
MATCH(Submissions.Title, Submissions.Summary, Submissions.Keywords)
   AGAINST ('$searchstring')";

But Ive got a problem ordering them by score now.

#8 Hilly_2004

Hilly_2004
  • Members
  • PipPipPip
  • Advanced Member
  • 63 posts

Posted 12 March 2006 - 01:05 AM

Nah still not having any luck...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users