Help me .. !! I 'm in the final project , build a web with Framwork CodeIgniter . but I difficulty to make a difference in the control script , the examples I list dated 07.02.2015 and should regristasi before 3 days but I forgot to register so it appears the warning .. how to make
irwan you have to run cron job for check the date daily. By cron job run this code :
$current_date=date('Y-m-d');
$date = strtotime($date);
$date = strtotime("+3 day", $date);
$adate=date=date('Y-m-d', $date); // this is after three days's date.
then run the query:
$this->db->where('date',$adate);
$q=$this->db->get('table');
then do something(whatever you want like send mail or anything) if you get data from above query. Hope you got the point :)
CREATE TABLE date (date1 timestamp, date2 timestamp);
INSERT INTO date VALUES ('2010-03-11 12:00:00', '2010-03-30 05:00:00');
INSERT INTO date VALUES ('2010-03-11 12:00:00', '2010-03-30 13:00:00');
INSERT INTO date VALUES ('2010-03-11 00:00:00', '2010-03-30 13:00:00');
INSERT INTO date VALUES ('2010-03-10 12:00:00', '2010-03-30 13:00:00');
INSERT INTO date VALUES ('2010-03-10 12:00:00', '2010-04-01 13:00:00');
SELECT date2 as d2,date1 as d1, DATEDIFF(d2, d1) AS diff FROM date;
+---------------------+---------------------+------+
| d2 | d1 | diff |
+---------------------+---------------------+------+
| 2010-03-30 05:00:00 | 2010-03-11 12:00:00 | 19 |
| 2010-03-30 13:00:00 | 2010-03-11 12:00:00 | 19 |
| 2010-03-30 13:00:00 | 2010-03-11 00:00:00 | 19 |
| 2010-03-30 13:00:00 | 2010-03-10 12:00:00 | 20 |
| 2010-04-01 13:00:00 | 2010-03-10 12:00:00 | 22 |
+---------------------+---------------------+------+
5 rows in set (0.00 sec)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.