Refactor db_helper_compare_days()

Proposed fix for https://www.mantisbt.org/bugs/view.php?id=17980

I have not fully tested this.
It would be easier to read if the parameters are ordered as: $p_val1, $p_operator, $p_val2, $p_seconds.