Solved

full text search

Posted on 2002-05-06
6
196 Views
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");
0
Comment
Question by:owarnes
  • 2
  • 2
  • 2
6 Comments
 
LVL 4

Expert Comment

by:lokeshv
ID: 6991500
try this..

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


LK

0
 
LVL 2

Expert Comment

by:jpoesen
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

0
 
LVL 2

Accepted Solution

by:
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);
$query2="...AGAINST (SKILLSCONST);
 
To lokeshv : that may work, but then owarnes doesn't take advantage of the FULLTEXT INDEX, as was his intention, I think.

Good luck.
jpoesen
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:owarnes
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
0
 

Author Comment

by:owarnes
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");
0
 
LVL 4

Expert Comment

by:lokeshv
ID: 6991672
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

759 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now