SangrelX Posted February 9, 2011 Share Posted February 9, 2011 Ok basic setup is Table name = unit_data I have a field unit_paid_date colum type = DATE unit_paid_date = 2011-03-02 thats yyyy-mm-dd lets say for example the DueDate is the Second of every month I need to select all records from unit_data that are PAST DUE so if the last paid date is 2011-01-02 that record will pop up as PAST DUE BUT if that paid date is say 2011-03-10 it will not be shown because the invoice was paid Ahead of due date I had this almost working properly -- but can use any help you guys offer. I was attempting to use mysql WHERE queries and do checks against paid_date but failed Thanks Quote Link to comment Share on other sites More sharing options...
anups Posted February 9, 2011 Share Posted February 9, 2011 you can use following query :- You can modify month or day accordingly SELECT *, concat(date_format(now(),"%Y"),"-",date_format(now(),"%m"),"-", "2") as dates FROM `todolist` WHERE `due_date` < concat(date_format(now(),"%Y"),"-",date_format(now(),"%m"),"-", "2") Quote Link to comment Share on other sites More sharing options...
SangrelX Posted February 9, 2011 Author Share Posted February 9, 2011 you can use following query :- You can modify month or day accordingly SELECT *, concat(date_format(now(),"%Y"),"-",date_format(now(),"%m"),"-", "2") as dates FROM `todolist` WHERE `due_date` < concat(date_format(now(),"%Y"),"-",date_format(now(),"%m"),"-", "2") Here is the Select im using SELECT *, concat(date_format(now(),"%Y"),"-",date_format(now(),"%m"),"-", $daydisp) as dates FROM $pm_units WHERE unit_paid_date < concat(date_format(now(),"%Y"),"-",date_format(now(),"%m"),"-", $daydisp) I see where your going with this but it will not work. this is comparing the Date in the field unit_paid_date to the current Date with the Day being a variable which is the actual DAY each month its due im lost but then again ive been trying to learn how to do this for a while now it should be simple if the user pays his bill ahead of the due date it leaves him alone if the users bill was paid say LAST month on the 2nd then it will be marked as late and the record shown I had at one time it worked all execept say if the user paid his bill Ahead of time it still marked it as a late payment .. and i didnt fully comprehend why so i removed that code and now I dont remember what it was lol.. i hope someone understands my end goal here and can help me out Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.