Monday, 15 August 2011

PHP Is MySQL DATETIME Field 14 days ago from todays date -


I am trying to write PHP code which will see if a date in a mysql database (2013-06-05 ) 14th

  $ sql = "SELECT * table";  

I have selected the necessary records to use the Msecol Select statement. $ Rs = mysql_query ($ sql, $ conn) or die (mysql_error ()); While ($ result = mysql_fetch_array ($ rs)) {if (strotomeme ($ result ['time-time']); Stotman ('- 14 days')) {echo 'yes'; }}

but do not display it which I have resonated. Any ideas?

im basically trying to set up an invoice reminder system. I have 3 columns:

  before_renders seconds_readers third_render   < P> Therefore, after 14 days, the  datetime  field will send an email and the date on which the email was sent to the first_armament field, that day will be reverted after the 7th day of the first day. ...   

You can do this with MySQL, you can use PHP The sector will have to think a little differently. To see if something is more than 14 days in the past.

  Select from table where some_date & lt; Curdate () - Lag 14 days   

To see if this is within the last 14 days.

  Select * from table where some_date & gt; Curdate () - Interval 14 days   

Another way is to draw the actual number of difference of day in the form of calculations (the first number decreases the second number) DATEDIFF function:

  select *, DATEDIFF (kurt (date), date_field) as the date from the table   

then in PHP P>

  if ($ line ['day']> 14) {// it is two weeks old}    < / Html>

No comments:

Post a Comment