I'm developing a job portal where users can subscribe to search criteria if no results are shown.
My form is based on these fields:
Field, education and experience
The only required field i field name, so education and experience is optional.
Imagine I have 2 entries in my notification table which by the way looks like this:
id user_id field education experience
33 1 Landbrug
34 1 Landbrug Yes
So what I want to do is have a script running (CRON) every half hour to do a search in the user fields table and see if there's a match somewhere, if yes, add email to mail queue (another table).
User fields table:
field_id user_id field_title field_education field_experience
29 80 Landbrug Yes Nogen
30 80 IT No Nogen
31 81
I just can't figure out in my head how to do the proper SQL query, because I want to be able to find matches, even if the user only have 1 search criteria being "field" which is required, other criteria can be chosen to "all" or blank.
Any help is appreciated very much!