Hello to all,
I have somewhat of dilemma. I have created a php script for a client that works fine if executed manually but now he wants it as a cron job.
i don't have any problem creating a cron job, but apparently i can't call my php script, i have to call perl and cgi.
I thought you could call any file under a UNIX server.
Any suggestions on what i should do?
Cheers,
micmac
<?
$current_date = date("Ymd"); //now
$new_current_date = strtotime($current_date); //now-UNIX
$db = mysql_connect("localhost", "", "");
mysql_select_db("store",$db);
$result = mysql_query("SELECT * FROM pref WHERE expiry_date != ''",$db);
while ($row = mysql_fetch_array($result)) {
$catid = $row["CatID"];
$expiry_date = $row['expiry_date'];
$CatID = $row['CatID'];
$listing_position = $row['listing_position'];
$new_expiry_date = strtotime($expiry_date);
if($new_expiry_date < $new_current_date){
$sql = "UPDATE cat1 SET pref='N' WHERE CatID=$catid";
$sql1 = "UPDATE pref SET listing_position='',expiry_date='' WHERE CatID=$catid";
$sendto = "brian@ripefruit.com";
$subject = "Expired Preferential Listing ";
$message = "ID: $CatID\n\nURL: $listing_position\n\nExpiry Date: $expiry_date";
$from = "From: TMD<webmaster@ripefruit.com>";
mail($sendto, $subject, $message, $from);
$new_result = mysql_query($sql);
$result1 = mysql_query($sql1);
}
}
?>