hey,
anyone knows where to find or you mind telling me how to build searches for my website.
site search
Moderator: General Moderators
If you're looking for pre-made scripts, Hotscripts is always the first place to look. If you're looking at making your own - we'll need some more information.
Is your site content in files or in the database?
Is your site content in files or in the database?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
-
alexislalas
- Forum Commoner
- Posts: 44
- Joined: Sun Feb 19, 2006 10:09 pm
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
If you can find one that does what you want it to, why reinvent the wheel. However, if you love to take on projects just because you 'want to see if I can do this with PHP', then by all means, build one on your own. It really depends on you: your preferences, your abilities, your speed, your knowledge, your patience, your eye color. Well, not really your eye color, but all of the other stuff I said.alexislalas wrote:both, but most of it reads from a database.
whats better to find a script or try to do it by myself?
- aerodromoi
- Forum Contributor
- Posts: 230
- Joined: Sun May 07, 2006 5:21 am
It always depends on what the user input will be like.alexislalas wrote:both, but most of it reads from a database.
whats better to find a script or try to do it by myself?
Code: Select all
<?php
$query = "SELECT * FROM database WHERE text like '%$needle%' ORDER BY id DESC";
?>If you want to display the entries according to relevance, you'll have to sort this selection afterwards - perhaps by checking how many times a single entry contains your keyword (substr_count).
Additionally, if the user is likely to search for a misspelled word, you'll probably have to resort to SOUNDEX.
aerodromoi