Hello all. i'm new to mysql and a but of advice would be fantastic. I"m building a PHP website where i'm have problems getting my search query to work. I have built the search using AND and OR but this process is very limited. Here is the background. The user will be passing 4 variables from one page to another.
buildingname
buildingblock
projectnumber
date
Table to search in is called paintinfo, and has 17 diff fields within it. 4 of the fields corrispond to the above variables.
now if i search using the AND i get bad results because the code does not check to see if the variable is blank or not. I'm hoping there is a way to check to see if the variable is blank then do not use that variable. If the field has info in it then build the query using that variable. i've been searching the forums for an answer but cant seem to find one. If i did miss it posted somewhere else please point me in the right direction. Thanx all in advance for your time.
buildingname
buildingblock
projectnumber
date
Table to search in is called paintinfo, and has 17 diff fields within it. 4 of the fields corrispond to the above variables.
now if i search using the AND i get bad results because the code does not check to see if the variable is blank or not. I'm hoping there is a way to check to see if the variable is blank then do not use that variable. If the field has info in it then build the query using that variable. i've been searching the forums for an answer but cant seem to find one. If i did miss it posted somewhere else please point me in the right direction. Thanx all in advance for your time.
Comment