Jump to content

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.

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.