how to fetch data from database in php mysql using search button?

Today, We want to share with you search in php mysql with examples.In this post we will show you how to fetch data from database in php using search button, hear for how to search and filter data in html table using php and mysql database [ with source code ] we will give you demo and example for implement.In this post, we will learn about PHP AJAX Live Search Box Autocomplete with an example.

Ajax Live Database Search

Creating the Database Table

CREATE TABLE brands (
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    name VARCHAR(50) NOT NULL
);

Creating the Search Form

index.php





PHP Live MySQL Database Search - www.pakainfo.com





    


Processing Search Query in Backend

backend-search.php

 0){

                while($row = mysqli_fetch_array($response, MYSQLI_ASSOC)){
                    echo "

" . $row["name"] . "

"; } } else{ echo "

No matches found

"; } } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } } mysqli_stmt_close($stmt); } mysqli_close($link); ?>

php mysql search database and display results

Example

";
}
    mysqli_close($con);
    ?>

I hope you get an idea about Advanced Search using PHP.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment