MySQL For Beginners – Tutorial 3 – Searching a Database with PHP




This lesson will show you how to retrieve data from your database within a given filter. It’s a kind of basic search, but for databases. In today’s example, we’ll write …

source


24 responses to “MySQL For Beginners – Tutorial 3 – Searching a Database with PHP”

  1. i have a site and it has search form with 5 select boxes and 4 text input. how we can make a php script for that? if only one input i know how to do it but this much input. ? and if all selected no problem but if a few of them left blank and searched? how we can do it?

  2. I noticed that a lot of people were having the same problem that I did due to the concatenation error that comes after the mysql_connect_db command. I thought I would list the proper code for anyone to copy-paste it.

    $query = "SELECT * FROM randomtable WHERE Gender = '" . $gender . "'";

    For me, it was the multiple quotes that threw me off.

  3. Hello All me again, please review the HTML code as well, as I found the issue causing the mysql_fetch error, where I found my code like (VLAUE= "Female" ) instead of "VALUE= , it is typo but it will pass nothing to the php to execute.

    Hope this help you too

  4. Hello, I can not explain to you how much your tutorials helped me to understand and practice something i always though i can not understand, to complete your favour I need to know how is the WAMPSERVER setup as I've exactly same script and same steps but always getting the error (mysql_fetch_array() expects parameter 1 to be resource, boolean)

    Your feedback is highly appreciated
    Regards

  5. I ALSO HAVE THE SAME ERROR Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:xampphtdocssearchnew 1.php on line 11
    so whats wrong with my code can i dowload your code?

  6. @RezanKara It's tough to determine what's causing the error without seeing your code, as well as examining the setup of your database.

    The error message implies that $results does not contain the expected type of data. Try find out why that is.

Leave a Reply