php - automaticall updating the records every day -


i using code

$q = mysql_query("select `time` `table`"); $row = mysql_fetch_assoc($q); $timediff = time() - $row['time']; if ($timediff >= 86400){   //run code } 

but getting error in second line can please me this.

here go:

$datetime = new datetime("+1 days"); $date = $datetime->format("y-m-d h:i:s");  $timediff = time() - $row['time'];  if($timediff >= '$date) {   //code here  } 

edit:

you can update code in your_file.php , run this:

0 0 1 * * php /var/www/vhosts/your_somain.com/httpdocs/scripts/your_file.php 

this run once month, on first day of month @ midnight (i.e. january 1st 12:00am, february 1st 12:00am etc.):

for further explanation:

reference: tutsplus.com

hope you.


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -