PHP MySQLi Advance Live Searching

PHP MySQLi Advance Live Searching

Today, We want to share with you PHP MySQLi Advance Live Searching.
In this post we will show you Simple Search Using PHP script and MySQL, hear for Simple search with PHP, jQuery and MySQL we will give you demo and example for implement.
In this post, we will learn about How To Create A Database Search With MySQL & PHP Script with an example.

What You will Need?

you will need to the following list of the tools and technologies:

1st : My SQL database
2nd : PHP support
3rd : A text editor(Notepad++).

*) HTML form How to use GET(REQUEST) and POST(REQUEST) methods
*) connectd Connect to database(mysql)
*) PHP and MYSQL Communicate with database intigration
*) logic to Find matching database entries with given word or phrase search
*) browser to Display results in html display

  Setup Laravel 6 Login Authentication

I shall show you step by step how to build a simple search using mysql database,
yet more powerful,all database search from in which you will display your users list to search results on display web pages,
giving your html file web site a nice touch.

MySQL table structure with PHP script using that we use in this script is useful to insert(store details) details of a salesorder list.
You can (crud operation using PHP)add/edit/remove/delete any of the fields and eidt/modify the search script using php to print and any words-search your own custom made MySQL table using php script.

MySQL Table Search using PHP Example

index.php

<?php $db_hostname_parm = 'admin_test'; $db_username_parm = 'admin_test'; $db_password_parm = '@[email protected]'; $db_database_parm = 'userlist'; // script of php : Database Connection String in mysql $con_data = mysql_connect($db_hostname_parm,$db_username_parm,$db_password_parm); if (!$con_data) { die('php generate error display - Could not connect: ' . mysql_error()); } //connect this database mysql_select_db($db_database_parm, $con_data); ?>
//searching HTML form
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>Simple Create a Search Feature with PHP and MySQL</title>
    </head>
    <body>

<form action="" method="post">  
Search: <input type="text" name="term_data" />
  
<input type="submit" value="Seaching" />  
</form>

  
<?php
if (!empty($_REQUEST['term_data'])) {

$term_data = mysql_real_escape_string($_REQUEST['term_data']);     

$sql_query_generate = "SELECT * FROM sales_order WHERE product_Description LIKE '%".$term_data."%'"; 
$result_query = mysql_query($sql_query_generate); 

while ($row_data = mysql_fetch_array($result_query)){  
echo 'product_Primary key: ' .$row_data['PRIMARYKEY'];  
echo '
 User Code: ' .$row_data['product_Code'];  
echo '
 slaesorder Description: '.$row_data['product_Description'];  
echo '
 product Category: '.$row_data['product_Category'];  
echo '
 product Cut Size : '.$row_data['product_CutSize'];   
}  

}
?>
    </body>
</html>