AgerNic.com
WEB DEVELOPER SITE, HTML, CSS, PHP, SQL

How To Make A Simple Search Engine Using PHP And MySQLi


PHP MySQLi » Simple Search Engine Using PHP And MySQLi

Comments, usually are used to explain Python code,to make the code more readable and to prevent execution when testing code.

In this simple search engine which is searches to user date into the database. similar like google search engine it will check matched keywords to the table title, description, website URL or how you like.

Steps to follow in creating a simple search engine for your website

create table: search into your DataBase
CREATE TABLE `search`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(50) NOT NULL,
`description` TEXT NOT NULL,
)


How to Make Simple Search Engine using PHP and MySQLi - examples


We make a HTML file and save it with a name search.html

Creating Simple Search Engine using PHP and MySQLi
Example: search.html

<!DOCTYPE html>
<html>
<head>
<title>Simple search with PHO and MySQLi</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body>
<h1>Simple search engine with PHP and MySQLi</h1>
<form action="" method="post">
<input type="text" name="search">
<input type="submit" name="submit" value="Search">
</form>
<strong>Go back tu search page <a href="search.html">SEARCH AGAIN</a></strong>
<?php
$server_name = "localhost";
$user_name = "root";
$password = "";
$db_name = "my_data_base";

$con=new mysqli($server_name, $user_name, $password, $db_name);
if($con->connect_error)
{
echo 'Connection Faild: '.$con->connect_error;
}
else
$search_value=$_POST["search"];
$sql="select * from search where title like '%$search_value%' OR description LIKE '%$search_value%'";
$res=$con->query($sql);
while($row=$res->fetch_assoc())
echo "<strong>ID </strong>".$row['id']." <strong>Title:</strong> ".$row['title']." <strong>Description</strong> ".$row['description']."<br />";
?>

</body>
</html>



how to make simple php search engine
How To Make A Simple Search Engine Using PHP And MySQLi - php mysqli

Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


0
Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


jQuery replace...
jQuery replaceClass...
jQuery click ()...
jQuery switchClass()...
jQuery draggable()...
jQuery HTML...
jQuery scroll smooth...
jQuery scroll()...
jQuery stop()...
jQuery animate()...
jQuery SlideToggle()...
jQuery slideDown()...
jQuery slideUp()...
jQuery fadeToggle...
jQuery fadeOut()...
jQuery fadeIn()...
jQuery Effects - hide () and show ()...
jQuery Events...
jQuery Attributes...
jQuery Selectors...