Solved

full text search

Posted on 2002-05-06
6
205 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If 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 …

932 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

13 Experts available now in Live!

Get 1:1 Help Now