57: How to create a search field with PHP and MySQLi | PHP tutorial | Learn PHP programming

How to create a search field with PHP and MySQLi – Learn PHP backend programming. In this video we will learn how to create a search feature using PHP from scratch.


First of all, thank you for all the support you have given me!

I am really glad to have such an awesome community on my channel. It motivates me to continue creating and uploading content! So thank you!

I am now using Patreon to share improved and updated lesson material, and for a small fee you can access all the material. I have worked hard, and done my best to help you understand what I teach.

I hope you will find it helpful 🙂

Material for this lesson:

Nguồn: https://top100vn.com/

Xem thêm bài viết khác: https://top100vn.com/cong-nghe/

28 thoughts on “57: How to create a search field with PHP and MySQLi | PHP tutorial | Learn PHP programming

  1. Is it wise to query the db directly for every search like this? would it not be less intensive on the db to scrape the webpage itself? or something similar im not sure

  2. Hello i followed your tutorial and got a problem : when i click the search button when the text field is blank, it shows all the data from the database i want only when something is typed to be displayed, can you help me fix it

  3. Facing a problem for weeks now….I wanna present my php database content with the ".innerhtml"- mantaining html format with linked stylesheet in the search page

  4. why I have all the time the result 0 ?



    $search = mysqli_real_escape_string($con, $_POST['search']);

    $query = 'SELECT * FROM messages WHERE message LIKE "%$search%" OR auther LIKE "%$search%"

    OR date LIKE "%$search%"';

    $result = mysqli_query($con, $query);

    $queryresult = mysqli_num_rows($result);

    echo "There are " .$queryresult. " results";

    if($queryresult > 0){

    while($row = mysqli_fetch_assoc($result)){

    echo "<div class ='box-search'>







    echo "There are no results matching your search";




  5. Question. I added a url column to the code. I can echo out the url, but I can't make it clickable. If I try to echo out the url row in href="' it breaks the code. Any help will be much appreciated.

  6. Fantastic lesson. This will keep me busy coding my own website for the next week. So many questions I had have been answered in this video. Huge thanks.

  7. Hey Daniel! I love your videos! One question — do you know how to make a wiki-like website in PHP? i.e. a site where anyone can edit posts? Thanks! Keep up the amazing work!

  8. I just have one question. How to update the table? Supposed we have a table on our page so when I clicked the submit button the data in the table will just update the data of that table to the result we got instead of opening a new page and generating a new table again.

  9. Hello bro I am unable to login to phpmyadmin to connect to MySQL and getting this error and I tried all the trouble shooting steps but still same issue, "Failed To Set Session Cookie. Maybe You Are Using HTTP Instead Of HTTPS To Access PhpMyAdmin."

  10. Dude… I'm here in 2020 and your tutorials are just the best, no doubt about it. You explain everything so good and I have NEVER failed with something when watching your tutorials. Are you a magician or something? haha 😀

    SHOUT OUT ALL THE WAY FROM SOUTH AFRICA!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  12. Dear Most of sites I have seen are with html extension, how to change parsed php extension into html extension.

Leave a Reply

Your email address will not be published. Required fields are marked *