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.
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now


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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
reverse engineer .sql from php files 11 54
PHP: Best way to scan folders and process files 10 63
Multi line FPDF footer: 3 30
How to use 2 ON statements in inner join 3 27
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Introduction This article is intended for those who are new to PHP error handling (  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

730 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