$userId = $_SESSION["profile"]["id"];
$pdo = new PDO('mysql:host=localhost;dbname=dbname;charset=utf8mb4', 'username, password');
$adsFinishNotifications = $pdo->prepare('SELECT `ads_title`, `ads_period_publication` FROM `uni_ads` WHERE `ads_id_user`=:iduser');
$adsFinishNotifications->execute([':iduser' => $userId]);
$result_array = $adsFinishNotifications->fetchAll();
foreach ($result_array as $result_row) {
$adsTitle = $result_row["ads_title"];
$dateFinish = $result_row["ads_period_publication"];
$dateFinishSec = strtotime($dateFinish. " - 1 day");
$dateNow = date("Y-m-d H:i:s");
$dateNowSec = strtotime($dateNow);
if($dateFinishSec == $dateNowSec){
echo '<li class="blog-notifications">';
echo '<i class="las la-sticky-note"></i>';
echo '<a href="' . _link( "user/" . $user["clients_id_hash"] . "/ad" ) . '">' . $adsTitle . ' — срок объявления подходит к концу. Конец: '. $dateFinish .'</a>';
echo '</li>';
}
}
$pdo = null;