FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Search Script





NG
does any one no where i can get a search script tht looks for stuff on my site they looked for you can see one on www.runehq.com in the item database
deepak
There is a very powerful search engine in PHP+MySQL .. its called "TSEP" search about it.
edgarinvillegas
One non-optimal solution could be:

SELECT * FROM table
WHERE searchField1 LIKE '%searchText1%'
AND searchField2 LIKE '%searchText2%'

It does its job, but is relativly slow, and de searchText must be the exact phrase to search. If your database isnt big, you could use this.

But the optimal solution is a FULLTEXT index, MySql developed it right for this purposes: search.

Once you have created your table, you have to create a FULLTEXT index envolving all the fields you want to be in the search.

Then, while writing the query, you have to use MATCHCASE for doing it.
edgarinvillegas
Hi, it's me again.
Here I have the explanation for doing searches with FULLTEXT and MATCHTEXT (in PHP and Mysql).
It's been extracted from programacion.com.

To create the index:
ALTER TABLE ARTICULOS ADD FULLTEXT(TITULO, DESARROLLO);

To do the query:
SELECT * , MATCH (TITULO,DESARROLLO) AGAINST ('$busqueda') AS puntuacion
FROM ARTICULOS WHERE MATCH (TITULO, DESARROLLO) AGAINST ('$busqueda')
ORDER BY puntuacion DESC LIMIT 50
The result is scoring for the words searched, more score, more exact the search.

This searches quickly!!
NG
thxn this really helped me Very Happy
Related topics
Search function
MySql issues
PHP - checking lengths
AJAX tutorial [2nd part now updated]
search script.
Creating a Search Script with PHP for MySQL
Highlighting Search Terms
sick of the old boring Tree system for everything(like CMS)
Blog Search
What is Google doing?
Make me a search script !!! For loads of Frih$'s !
Will work for FRIH$
Search Script..?
Search Script
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.