full text search

Posted on 2002-05-06
Last Modified: 2008-07-03
I am trying to get my search working

this is the query i am using but it is coming up with an error

I am trying to select all from table jobs from row d where the match is the variable skills

$query2 = "SELECT * from jobs WHERE MATCH d AGAINST ('$skills')";
$result2 = mysql_query($query2,$connection) or die("Error in query matching");
Question by:owarnes
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2

Expert Comment

ID: 6991500
try this..

select * from jobs where d like '%$skills%' ;



Expert Comment

ID: 6991509
1. to be able to search a FULLTEXT index, you have to specify the fulltext index(es) when creating the table, or later by ALTER TABLE. Have you done this?

2. You say :'...from row d ' -> is 'd' a valid *fieldname* in your MySQL table? And is it of type varchar or text?

3. try putting 'd' between braces :
SELECT * from jobs WHERE MATCH (d) AGAINST ('$skills')

4. stupid, but you never know : has $skills been assigned


Accepted Solution

jpoesen earned 100 total points
ID: 6991517
I hate it when that happens...

Ok, I was saying :

4. stupid, but you never know : has $skills been assigned a value?

5. The MySQL manual says : "The argument to AGAINST() must be a constant string" so maybe it'll work if you do this :

define ("SKILLSCONST", $skills);
To lokeshv : that may work, but then owarnes doesn't take advantage of the FULLTEXT INDEX, as was his intention, I think.

Good luck.
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.


Author Comment

ID: 6991524
lokeshv you answer works, but it is not quite what i wanted. I want to use match.

jpoesen i have specified the fulltext indexes, i have echoed out $skills so i know that is there. The row type is text not varchar

Author Comment

ID: 6991539
now it looks like this and guess what it doesn't work!

define ("SKILLSCONST", $skills);

$query2 = "SELECT * from jobs WHERE MATCH (d) AGAINST (SKILLSCONST)";
$result2 = mysql_query($query2,$connection) or die("Error in query matching");

Expert Comment

ID: 6991672

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question