Generally dynamic websites hosts tons of data with them. Searching for a particular thing is very tedious task if websites don't have proper searching functionality. For such requirement this search tool is perfect if you want a quick and easy way to search your dynamic websites.
--
-- Database: `search-engine`
--
-- --------------------------------------------------------
--
-- Database creation for `search-engine`
--
CREATE DATABASE search-engine;
--
-- Table structure for table `mobiles`
--
CREATE TABLE IF NOT EXISTS `mobiles` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`type` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
--
-- Dumping data for table `mobiles`
--
INSERT INTO `mobiles` (`id`, `name`, `type`) VALUES
(1, 'Samsung Wave', 'Bada OS'),
(2, 'Samsung Note', 'Android'),
(3, 'Nokia Lumia', 'Windows OS'),
(4, 'IPhone', 'IOS'),
(5, 'Motorola', 'Android'),
(6, 'Samsung Galaxy', 'Android');
</script>
Having a search feature on a dynamic website is very handy for helping users find exactly what they are looking for. Almost all users now prefer different search engines to find what they are looking for. Search engines range from something very simple to very complicated as Google, MSN, Bing, Yahoo etc. In this tutorial, our scope is limited to searching a simple database table and extract those results from database. I hope it gives a little idea to build bigger search engine for developing more complex search engine like Google.
This tutorial assumes whatever the data you want to search will be stored in the MySQL Database table. In this tutorial, we will use a simple query to search the data from the MySQL database table. No complex algorithms will be used. Using of such complex algorithms is beyond our tutorial's limit.
Before we start off this tutorial, we need a database. The code below will create a testing database to use as you work through the tutorial.
Step 1: Creating a database called "search-engine" and table called "mobiles".
<script type="syntaxhighlighter" class="brush:html">--
-- Database: `search-engine`
--
-- --------------------------------------------------------
--
-- Database creation for `search-engine`
--
CREATE DATABASE search-engine;
--
-- Table structure for table `mobiles`
--
CREATE TABLE IF NOT EXISTS `mobiles` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`type` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
--
-- Dumping data for table `mobiles`
--
INSERT INTO `mobiles` (`id`, `name`, `type`) VALUES
(1, 'Samsung Wave', 'Bada OS'),
(2, 'Samsung Note', 'Android'),
(3, 'Nokia Lumia', 'Windows OS'),
(4, 'IPhone', 'IOS'),
(5, 'Motorola', 'Android'),
(6, 'Samsung Galaxy', 'Android');
</script>
Did You Enjoy this Article ?
If yes, Then enter your email below to get
more such great articles in your inbox
For FREE !

No comments:
Post a Comment