DH Templates

How hard is it to make a search bar on your website?

I have taken Mysql and PHP classes but the teacher wasn't that good at teaching and it was really hard to understand him. I heard it is pretty simple, I have basic knowledge of Mysql and PHP. Or can I just use a free template somewhere on the web?

Public Comments

  1. Yahoo will provide you with the code to put a yahoo search on your website.
  2. Use Google CSE: http://www.google.com/coop/cse/ "With Google Custom Search, you can harness the power of Google to create a customized search experience for your own website."
  3. I've done it, I made a spider program to start in one directory and fine all the files and folders and insert them and some information about the file/folder into a MySQL database. Then I have another page the searches for your query. It wasn't to hard to do, took maybe 3 or 4 hours to get the whole thing up and running. If you need any help just send me an email.
  4. There are 2 ways of doing so, either place Google/yahoo custom search engine on ur web or make your own search engine for ur website. Its good that u have basic knowledge of PHP, MYSQL. this knowledge is sufficient to make a custom search engine for ur site.. I am going to briefly explain the process. U shud have a database created in MYSQL with some data in it. Suppose your are taking input from user via text box, now the major work gonna start, take that input value n then passs that in a SQL query. Suppose u have a table namely emp, and user wants to search for emp Id = 1 from ur website. You'll simply take that input from user and then in your PHP file you'll do the following. $query= Mysql_query("Select empId from emp where empId=$input_variable"); now this query will look for Emp id 1 in your database. use a loop to display data on ur page. Now you have successfully made your custom search engine for ur website
  5. Check hotscritps.com making a search is pretty easy Here is a simple example *not tested I might mess up SQL CREATE TABLE Pages( ID INT( 2 ) NOT NULL AUTO_INCREMENT, Tags VARCHAR( 200 ) NOY NULL, Content TEXT NOT NULL )ENGINE=MYISAM; FORM <input type="text" name="search_for" /><input type="submit" value="Search" /> PHP ...connection...select database.... $search = $_POST['search_for']; $sql = "SELECT `ID` FROM `Pages` WHERE `Tags` %LIKE% '{$search}'"; $result = mysql_query( $sql )or die( mysql_error( ) ); $results = mysql_fetch_array( $result ); foreach( $results as $row ) { print $results[0]; } ....end.... Hope that helps have a nice day, Philip Wayne
  6. If you are serious about searching your own site, then I would not depend on putting somebody's "free" search bar on your pages, such as Google's or Yahoo's. Neither will be up-to-date, and you are at the mercy of how deeply their spiders have crawled your site. Since you are familiar with PHP, I would suggest adding your own private search engine to your site. My recommendation is iSearch2 (see link below) which is free, fast, and in all respects excellent. It is written in PHP, so you can use it as-is or customize it. Search results are accurate and can be made to look Google-like. You have complete control over everything it searches for as well. You can see it in action by clicking the second link below and trying a search. This is a website that I built for a client that uses iSearch2
Powered by Yahoo! Answers