Good,
I have created a script that aims to determine if the ads_featured_dates Column Dates are expired or not ....
The problem is that the script updates the ones that have passed the date, but also those that have not yet passed ...
How do I solve it?
function check_promotions_date($con) {
$search_expire_dates = "SELECT ads_featured_date, ads_featured, ads_id
FROM public_ads WHERE ads_featured = 1";
$expire_query = $con->query($search_expire_dates);
while($expire_details = $expire_query->fetch_assoc()) {
$todays_date = date("Y-m-d");
$reset_days = "0000-00-00 00:00:00";
if($todays_date > $expire_details['ads_featured_date']) {
$update_dates = "UPDATE public_ads SET ads_featured_date = '$reset_days', ads_featured = 0";
$query_updated = $con->query($update_dates);
}
}
}