Database Query Ignore Empty Values Conditions

I have a search function in my app which makes a database query for a table notificaitons with a set of AND conditions something like this:

notifications.contact  equal $_GET.contact
notifications.activity equal $_GET.activity
notifications.status   equal $_GET.status

I want a search behaviour such that if any of those 3 $_GET inputs are not specified by the user then they are ignored in the search.

So for example, if the user only specifies contact #123 then it will find all notifications for contact #123 and ignore the values in the table for activity and status.

How can I do this in Wappler without needing to create lots of conditions and different database queries in my server action?

Bubble had an option called something like “ignore empty values” which was soooo useful!

I’m using MySQL and PHP.

Community Page
Last updated: