PDA

View Full Version : fulltext searching more than one table


faissaad1
Tue 6th May '03, 5:20pm
CodingForums.com > :: Server side development > MySQL

Post Preview:
Hi all,

I'm trying to use full text searchin in tree different tables wich are not connected to each other.

these are my tables

product_table
id
name(fulltext)
description(fulltext)
picture

service_table
id
name(fulltext)
description(fulltext)
picture

News_table
id
title(fulltext)
body(fulltext)
date

what i need is to search a %searchstring% coming from a form all these (fulltext) fields and return Matchs....I have read the
www.mysql.com/doc/en/Fulltext_Search.html but they onyl explain with one table! so If anyone knows how to use with more than one table pls. lemme now. I think I should make different querys but don't even know how to compine querys.

Thanks

Son-Goku
Tue 6th May '03, 5:48pm
did you try something like
SELECT product_table.id AS id, (what you need for output..)... FROM product_table, service_table, News_table WHERE MATCH (product_table.name, product_table.description) AGAINST $searchstring OR MATCH (service_table.name, service_table.description) AGAINST $searchstring OR MATCH (News_table.title, News_table.body) AGAINST $searchstring
i don't know if that works, i always do a option field in the form where the user can choose which table to search in, but maybe this'll work... (note that match against won't work unless you've got more than ~3 entries in the table, at least it didn't work for me some time ago).