DEV Community

skptricks
skptricks

Posted on

Ajax Live Search With PHP And MySQL

Today, In this tutorial we are going to discuss how to create php ajax live search box using MySQL database. Now a days every website has integrated this kind of search feature. This search box populate the results in real time from MySQL database based on entered text in search box.

Ajax Live Search With PHP And MySQL

We have implemented this ajax live search box demo using php pdo connection. When user enter any text in search box and click on search button, Then it will send the request to "controller.php" page, with the help of ajax call and display the realtime search result in "search.php" page. Check out our blog archive on the topic if you’re looking to learn about Ajax Search Box in PHP, MySQL and JQuery.

Learn how To Integrate Live Search In PHP And MySQL With JQuery :
Lets see the complete example to create live ajax search box.

Download Code

Top comments (2)

Collapse
 
crease29 profile image
Kai Neuwerth

I'm sorry if it may sounds rude or condescending but this code has nothing to do with clean or maintainable code. You don't even filter user input which you should and even more important: Tell your readers why it is important to never trust user input.

This is an absolute beginner tutorial (please tag so at least).

Collapse
 
devhead profile image
dev-head

Yeah, need to second this just in case someone comes along and wants to use it for anything close to production...it's not production code. I suspect the author is using these as his own learning process, though I would hope he would indicate that in big bold letters somewhere.

tips for improving the video... show the code, talk about the code, show a demo too. the video given scrolls through some code real quick and then we watch five minutes of someone using a search box.

Only feedback on the code i'd give is please for the love of anything that's holy, don't use spaces in a directory name. https://github.com/skptricks/php-Tutorials/tree/master/Ajax%20Live%20Search%20With%20PHP%20and%20MySQL

if author asks for a code review, happy to give feedback || submit a pull request.