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
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”
Much better mic than previous tutorials ๐
Does anyone know why this tutorial doesn't work with the POST method?
Nice. But why only 3 tutorials??
thank you so much.. you make my day..
I really agree with this great suggestion, It would make it better for most.
You specified that data type in parameter "1" to be boolean instead of char or int.
How can i solve this problem ?
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean
How do you make it do the persom enters their name, surname, email?
HELP!
and here what if radio button not selected and clicked go? if i wanted to show all results in this case. how?
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?
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.
I wish you had more MySQL for Beginners videos, are very instructive!
The sane error ๐ i would like it if someone could help ๐
I have the same error! :(. Anyone know whats wrong?
I got an error, but I figured it out myself, thanks
@RezanKara try… FROM `randomTable`… those quotes on the table.It's just some syntax mismatch between mysql and the php code we write.
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
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
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?
@scottkorber thank you scott, I was able to solve it.
@DJsammieG is the table name randomtable or randomTable. The names are case sensitive.
I am getting the error: Parse error: syntax error, unexpected T_VARIABLE in C:Program Files ( on line 33
LINE 33: $query = "SELECT * FROM randomtable WHERE Gender='" . $gender "'";
@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.