php - how to send automatically email -


i programming 1 application check records depending on creation date, need application check post date automatically, if more or equal 2 days send notification email without action users or admin.

i know crontab solution know working on specified time. how can needs?

mysql posts table

id  |   post    |   date 1   |   post 1  |   1394094854 2   |   post 2  |   1394094754 3   |   post 3  |   1394094654 4   |   post 4  |   1394094554 

my script.php

<?php define('dbhost', 'localhost'); define('dbname', '-'); define('dbuser', '-'); define('dbpass', '-'); /* / $db ====> mysql connection */  $getposts = $db->query("select * posts"); foreach($gp $getposts){     if(time() - $gp['date'] >= 172800){ // morethan or equal 2 days         // send notification email          mail('to_email', 'subject', 'message', 'headers');     } } 

please me in issue. best regards sami mansour

you need create cron , call script page sends email.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -