hello, i am developing a php program for a hostel. i want get a email notification on a special date if anyone don't pay rent. how can i do this on php .. any idea ? ----------------------------example ----------------------------- hostal have 25 rooms.. one person joind hostal on 15th date his room number is 15, so every month 15 th date i want to get a email notification if he not paid rent ... any idea ?
Please tell us what you already have? are u using a CMS for your hostel? and about the payments? how do you read your payments? by hand?
There's probably 100 different ways to do it and it'll depend on your existing codebase, but to get you going in the right direction... - Assuming you have the person stored in a db. You'll have a 'next_payment_due' date. - On initially adding the person set this to 1 months time. - You'll need a php script which runs daily (cron task) that looks up any people in the db for which the next payment date is less than today. - i.e. SELECT * FROM person WHERE next_payment_due < NOW(); - Loop the results and use the php mail() function to send the email. - When a person pays, set their new 'next_payment_due' a month ahead. (well x months ahead based on their original date so the dates keep in sync) There's loads of improvements you could make to the above principle however it should get the basics going.
Its pretty simple you should store date in the table and when that date and current date matches you should use mail function of php to send notification to their email address
you can setup a cron job and write down email function which runs from tenant date of joining to every 30 days.
Yes Cron Job Is Best For It. Create Your Script And Add It In Your Con Job Settings With Date & Time... Then Your Script Will Be Run Automatically On That Date & Time.