I want to call a Php function using the MYsqli trigger and I have found that this has a lot of security threat. I want to send an sms daily at certain time to all those in my database who's license expiry is within 7 days so what should be my approach to this?
Asked
Active
Viewed 120 times
1
-
2Get the list of users and simply throw a `cron` instead of invoking it from MySQL trigger – Narendrasingh Sisodia Jun 13 '16 at 05:35
-
try this http://stackoverflow.com/questions/8004710/run-php-file-at-scheduled-times or http://stackoverflow.com/a/9122112/5612089 – Vishwesh Jainkuniya Jun 13 '16 at 05:38
-
use cronjob to execute a php file at a time – JYoThI Jun 13 '16 at 05:42
1 Answers
0
Easy to do by cron .its my suggestion
This is the best explanation with code in PHP I have found so far:reference
cron.php
<?php
echo "hiiii";
Do ur stuff here ....
?>
You can edit the crontab usually (not always the case) by entering crontab -e in a ssh session on the server.
every minute
*/1 * * * * php /var/www/path/to/cron.php
Above code execute the cron.php every seconds once.customize by your need
The stars represent (* means every of this unit):
[Minute] [Hour] [Day] [Month] [Day of week (0 =sunday to 6 =saturday)] [Command]

JYoThI
- 11,977
- 1
- 11
- 26
-
I am currently running my php and mysql in my windows system(Localhost) can this be done in windows also? – Sandeep Jun 13 '16 at 06:35
-
try this http://stackoverflow.com/questions/9894804/use-php-to-set-cron-jobs-in-windows – JYoThI Jun 13 '16 at 06:44
-
Thanks jothi http://stackoverflow.com/questions/9894804/use-php-to-set-cron-jobs-in-windows this worked – Sandeep Jun 13 '16 at 10:23