coding problem on php auto send mail after a period
hi all, im trying to develop a webased helpdesk, it will auto send a email to engineer after 1 day, 3 day, 5 day & 7day if the status of the report is open. both my crontab and php mail function are working well. now my problem is no idea how to set the condition in php about the date it will send email after the period. hope someone can help me and very appreciate with that, thanx alot.
|
Hey, not too sure on your problem, I don't quite understand what these reports are :S, but you may need to have a read up on the php date function @ http://php.net/date.
Below is a simple program I have wrote for you to demonstrate how to work out the previous date. PHP Code:
There are some problems with this however, if you look at the output: Code:
20050830 |
hi tomj88, thanx u so much, u did help me a lot :)
im facing the problem too which the date will not move into nest month and it become 32th after adding the date. hey guyz do u know what to do on this problem, plz give me a hand on it :) |
I suppose you could make some huge switch case or if else statement that checks this, basically make a calender, but this may become highly complicated...
|
I haven't coded in php much recently, so the syntax is probably wrong...
If you build up an array of the months and how many days they have, you can address the arrays later to shorten the code. PHP Code:
I would say it would be best to run a for or do while or while loop when you are adding, and only add 1 each time (or reduce). This would be better because instead of going right over, say up to day 35, you could check on each itteration if the day is too high, and then adjust accordingly. I hope this helps... I will try to build a simple callender later on tonight if you don't manage it now ;). Keep me updated on how its going. |
Quote:
|
thanx so much. im trying now, hope everything go well :)
|
This doesn't solve your problem, but it shows you how you could possibly solve it.
PHP Code:
|
thanks for ur help. i just found a code, i think this can help me out, hopefully :D
PHP Code:
Quote:
|
edit: Removed this post, its the same as next but I had a little problem in the code in this one, and the second one I though I clicked edit but I must have clicked new post... sorry!
|
I was bored so I tried to implement this for you. I think you should be able to understand this, and I hope that it fulfils your needs. I'm sure there are better ways of doing this, just a quick little hack :)
PHP Code:
|
been trying whole day, finally get something :D now i using crontab run this page 10am everyday.
PHP Code:
Quote:
|
cool, glad to here you got it working mate!
Tom |
All times are GMT -5. The time now is 10:30 PM. |