how to create powerful search engine in php



how to create search engine in php 




Connection php

<?php

 $conn_error = 'Could not Connect.';
 $mysql_host = 'localhost';
 $mysql_user = 'root';
 $mysql_password = '';
 $mysql_db = 'search_database';

 if(!@mysql_connect($mysql_host, $mysql_user, $mysql_password)||!@mysql_select_db($mysql_db)){
  die($conn_error);
  
 }
?>


<?php

  require 'connect.inc.php';

  if (isset($_POST['search_name'])){
  
  $search_name = $_POST['search_name'];
  
  if(!empty($search_name)){
  
  if(strlen($search_name)>=2){
  
     
   $query = "SELECT * FROM `job_employe_search` WHERE skills LIKE  
   '%".mysql_real_escape_string($search_name)."%'";
   
   $query_run = mysql_query($query);
   
   
    $query_num_rows = mysql_num_rows($query_run);
 
   
   if($query_num_rows>=1){
    
echo $query_num_rows.' Results found:<br>';
   
  while($query_row = mysql_fetch_assoc($query_run)){
  echo $query_row['cmp_name'].'<br>';
  echo $query_row['salary'].'<br>';
  echo $query_row['location'].'<br>';
  echo $query_row['skills'].'<br>';
  echo $query_row['experience'].'<br>';
  echo $query_row['job_cat'].'<br>';
  
  
  }
   
   }
   
   else{
     
   echo 'No result Found';
   
   }
  }
  
  else{
  
    echo 'Your Keyword Must be 3 characters or more.';
  
  }
  
}
 
else{
 
   echo 'Please Enter your Keywors';
 
}
  
  
  }
  
   


?>

<form action="index1.php" method="post">
  <h2>  PHP  Search Engine </h2>
  <hr />
  Name : <input type="text" name="search_name" /> 
  <input type="submit" value="Seaech" />
</form>

Database 

-- Table structure for table `job_employe_search`
--

CREATE TABLE IF NOT EXISTS `job_employe_search` (
`id` int(11) NOT NULL,
  `mobile` varchar(30) NOT NULL,
  `email_id` varchar(50) NOT NULL,
  `cmp_name` varchar(100) NOT NULL,
  `salary` varchar(50) NOT NULL,
  `location` varchar(100) NOT NULL,
  `skills` varchar(200) NOT NULL,
  `experience` varchar(50) NOT NULL,
  `job_cat` varchar(100) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;




Post A Comment
  • Blogger Comment using Blogger
  • Facebook Comment using Facebook
  • Disqus Comment using Disqus

No comments :

Thanks For visiting Infotech Solutuion Blog