You can build the query with normal mysql syntax, then if you use a form, give the form name of the database field that you want to compare, and the value of the form input is the value you want to search for example 3, or some name. Then when the value returned is null, you normally don't take the field into the sql string. Its just some formatting you have to use in the controller, and its all automated, if the main purpose is directory listing or similar stuff
I suggest using the package once.
The query goes to the database only once.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.