I'm using MySQL and I have a table with these fields :
I want to create a form for searching based on user input. Example, if the user search is based on
name, but the fields
year are not filled with a value, then the form should retrieve the results based on
name. And if the user wants to search based on
year are not filled in, then the form would retrieve results based on
My query seems wrong, because I don't get the results that I want.
select * from teacher where name like '%".$name."%' or year = '".$year."' or kode_fakultas = '".$fak."