Tuesday, December 10, 2013

Create Your Own Search Engine in PHP -learnmore with @s.shivasurya

world wide search!
nowadays we are living in technological world,we search over internet from creating a food stuffs from you-tube till your loved ones on facebook :P .so our search always continues till our death.we search articles on internet and getting lot of results.so how does it works?
have you ever wondered about search Engine works,while you search for specific need on google, bing, or yahoo!

what is search engine?

web search engine is a software system that is designed to search for information on the World Wide Web. The search results are generally presented in a line of results often referred to as search engine results pages (SERPs). The information may be a specialist in web pages, images, information and other types of files. Some search engines also mine data available in databasesor open directories. Unlike web directories, which are maintained only by human editors, search engines also maintain real-time information by running an algorithm on a web crawler.

why search engine?

Searching through best sources like Google and Yahoo not only enhances the search results but it also enables users to cut down extra results. You can customize your search by using special marks and precisions. Advance searching is facilitated on different searching tools. You can also search about a particular word. Also you have an option to specify the type of information you are looking for. You can mention the type of file to cut down the search of other information.
Organized information:
Instead of exploring blogs and websites to find the relevant information, the results of search bars are organized. They will give relevant information which is organized and precise.
Best results of any search are possible if you know how to use these tools for searching. Learn techniques to improve your searching techniques.
your searches at google!

so lets see a simple coding in PHP to develop search in your database.

take a live demo here LIVE DEMO

download the script here download

create search table in mysql db:

CREATE TABLE IF NOT EXISTS `search` (`link` varchar(2000) NOT NULL,`title` varchar(2000) NOT NULL,`comment` varchar(2000) NOT NULL, `content` varchar(2000) NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>S-mail search engine</title>
<style type="text/css">
ol.update li
border-bottom:#dedede dashed 1px; 
ol.update li:first-child

border-top:#dedede dashed 1px; 

{ width:200px;
height:30px; padding:10;
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
<script type="text/javascript">
var search_word = $("#textboxcontent").val();
var dataString = 'keyword='+ search_word;


type: "GET",
url: "searchajax.php",
data: dataString,
cache: false,
beforeSend: function(html) 
document.getElementById("loadplace").innerHTML = ''; },
success: function(html){



return false;
<body><span><h2 style="font-family:Verdana, Geneva, sans-serif; margin-left:250px;">S-mail searches</h2></span>
<br />
<form method="get" id="form" >
<input type="text"  id="textboxcontent" class="textboxcontent" style="width:1000px; height:20px;"/><br /><br />
<input type="button" name="search" value="search now!" class="submit"/> </form>
<ol id="loadplace" style="height:auto;width:500px;margin-top:3px;" class="update">
<div id="flash" align="left" &#65533;></div></div>


<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">





$message = stripslashes($comment);
$comment = mysql_real_escape_string(nl2br(htmlentities($comment, ENT_QUOTES, 'UTF-8')));
$s=mysql_query("select * from search where content like '%$comment%' or link like '%$comment%' or title like '%$comment%' ");
{ ?>
<div id="smails" style="width:800px;height:80px;">
    <div id="org" style=" float:left; height:20px; width:800px;">
<a href="<?php echo $h['link']; ?>"><?php echo $h['title']; ?></a></div>
    <div id="org" style=" float:left; height:40px; width:800px;word-wrap: break-word;">
<?php echo $h['content']; ?></div>
    <div id="org" style=" float:left; height:20px; width:800px;">
<?php echo $h['comment']; ?></div>


<?php } }


this codes provides you a basic level search engine type! you could integrate it by developing a complete database.
if you feel free share your experience as comments! 


Algorithm Freak, Coder, Web And Android Developer, love to develop Apps for Local Business in my Freetime. For Queries,Quotes Drop me a Mail to s.shivasurya@gmail.com


Post a Comment

feel free to post your comments! Don't Spam here!


Copyrighted.com Registered & Protected  Z6HO-DGFO-S2CO-JRZGCopyrights Protected (C)2013-2015 i-visionblog ~ s.shivasurya.

Designed and Maintained by S.Shivasurya | S.Shivasurya