world wide search! |
have you ever wondered about search Engine works,while you search for specific need on google, bing, or yahoo!
what is search engine?
A 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.
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.
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
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;
search.php
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>S-mail search engine</title>
<style type="text/css">
*{margin:10;padding:0;}
ol.update
{
list-style:none;
font-size:1.1em;
margin-top:20px
}
ol.update li
{
height:70px;
border-bottom:#dedede dashed 1px;
text-align:left;
}
ol.update li:first-child
{
border-top:#dedede dashed 1px;
height:70px;
text-align:left
}
.submit
{ width:200px;
margin-left:200px;
height:30px; padding:10;
}</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript">
$(function()
{
$(".submit").click(function()
{
var search_word = $("#textboxcontent").val();
var dataString = 'keyword='+ search_word;
if(search_word=='')
{
}
else
{
$.ajax({
type: "GET",
url: "searchajax.php",
data: dataString,
cache: false,
beforeSend: function(html)
{
document.getElementById("loadplace").innerHTML = ''; },
success: function(html){
$("#loadplace").show();
$("#loadplace").append(html);
}
});
}
return false;
});
});
</script>
</head>
<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">
</ol>
<div id="flash" align="left" �></div></div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>S-mail search engine</title>
<style type="text/css">
*{margin:10;padding:0;}
ol.update
{
list-style:none;
font-size:1.1em;
margin-top:20px
}
ol.update li
{
height:70px;
border-bottom:#dedede dashed 1px;
text-align:left;
}
ol.update li:first-child
{
border-top:#dedede dashed 1px;
height:70px;
text-align:left
}
.submit
{ width:200px;
margin-left:200px;
height:30px; padding:10;
}</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript">
$(function()
{
$(".submit").click(function()
{
var search_word = $("#textboxcontent").val();
var dataString = 'keyword='+ search_word;
if(search_word=='')
{
}
else
{
$.ajax({
type: "GET",
url: "searchajax.php",
data: dataString,
cache: false,
beforeSend: function(html)
{
document.getElementById("loadplace").innerHTML = ''; },
success: function(html){
$("#loadplace").show();
$("#loadplace").append(html);
}
});
}
return false;
});
});
</script>
</head>
<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">
</ol>
<div id="flash" align="left" �></div></div>
</body>
</html>
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
</head>
<?php
include('config.php');
if(isset($_GET['keyword']))
{
$comment=$_GET['keyword'];
if(get_magic_quotes_gpc())
{
$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%' ");
while($h=mysql_fetch_array($s))
{ ?>
<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>
</div>
<?php } }
?>
</html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
</head>
<?php
include('config.php');
if(isset($_GET['keyword']))
{
$comment=$_GET['keyword'];
if(get_magic_quotes_gpc())
{
$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%' ");
while($h=mysql_fetch_array($s))
{ ?>
<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>
</div>
<?php } }
?>
</html>
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!
if you feel free share your experience as comments!
0 comments:
Post a Comment