Invalid query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by pay_date desc limit 1' at line 1
Whole query: select * from member_payment where (pay_type = 1 or pay_type = 3 or pay_type = 4) and member_id = order by pay_date desc limit 1