problem with this error message

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
barrowvian
Forum Commoner
Posts: 47
Joined: Tue Aug 19, 2008 3:49 pm

problem with this error message

Post by barrowvian »

When I try to use my search function I get this error message;

Code: Select all

Problem with the query: SELECT *, MATCH(company_name, search_data) AGAINST('%00000001%') AS score FROM adverts WHERE MATCH(company_name, search_data) AGAINST('%00000001%') LIMIT 1, 500
Can't find FULLTEXT index matching the column list
Im not sure what the problem is though as I have made sure that the db table is FULLTEXT etc. Please could someone help me out.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: problem with this error message

Post by requinix »

Your table needs a FULLTEXT index on both of those columns. Having one on each individually does not count. Ask whoever maintains your database to add one.

However it looks like you just want a regular LIKE search...
barrowvian
Forum Commoner
Posts: 47
Joined: Tue Aug 19, 2008 3:49 pm

Re: problem with this error message

Post by barrowvian »

i found this code to alter the table;

Code: Select all

ALTER TABLE adverts ADD FULLTEXT (company_name,,search_data)
Its still not working though :/ is there any other way that i can change it myself?
barrowvian
Forum Commoner
Posts: 47
Joined: Tue Aug 19, 2008 3:49 pm

Re: problem with this error message

Post by barrowvian »

nevermind, i just dropped the database and started from scratch :)

CREATE TABLE adverts
(
id INT(255) NOT NULL AUTO_INCREMENT,
company_name varchar(255) NOT NULL,
company_link varchar(255) NOT NULL,
contact_name varchar(255) NOT NULL,
contact_email varchar(255) NOT NULL,
image_link varchar(255) NOT NULL,
search_data varchar(255) NOT NULL,
PRIMARY KEY (id),
FULLTEXT(company_name, search_data)
);

worked this time
Post Reply