Jump to content

Cron job not taking effect


$php_mysql$

Recommended Posts

could someone check what is wrong in this code that no db entry nor image is being deleted

 

$time_count = 2*24*60*60; 
$match_time = time() - $time_count; 
$sql="SELECT id FROM tbl WHERE adtime < '".$match_time."'";
$result=mysql_query($sql);
if(!$result){
echo 'SELECT failed: '.mysql_error();
}else{
while($row=mysql_fetch_array($result)){
$id = $row['id'];
if(!unlink($row['image'])){
echo "unlink ".$row['image']." failed";
}else{
}
$sql="DELETE FROM tbl WHERE id = '".$id."'";
$result= mysql_query($sql);
if(!$result){
echo 'DELETE from tbl with id '.$id.' failed: '.mysql_error();
}
executeSql($sql);
} 
} 

Link to comment
https://forums.phpfreaks.com/topic/244537-cron-job-not-taking-effect/
Share on other sites

Make sure your chmod permissions on crontab.php script is set to 755 or 777

 

 

http://net.tutsplus.com/tutorials/php/managing-cron-jobs-with-php-2/

 

This really explains how to create a PHP class that handles cron jobs using PHP.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.