Solved

full text search

Posted on 2002-05-06
6
219 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to count occurrences of each item in an array.
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 …

825 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