I need modifications/additions to the PHP code below that will accomplish two goals:
(1) eMail a list of all unique "TransferDate" values that are in records that will be deprecated when the "$deadify_stmt->execute()" is run.
(2) Although the DBRStatus value is being modified correctly as a result of this script, DBRDeadDate is not being set. I need the correction to my code to fix that.
======================================
Here are the relevant snips of my PHP code (it works other than setting the DBRDeadDate):
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
include "[login to view URL]";
date_default_timezone_set('America/New_York');
/// Define comparison rules for determining which data lines need to be deprecated
$deadify = "UPDATE DBRData SET DBRStatus = 'Dead', DBRDeadDate=Now() WHERE ( ((ChargeID,FolioID,Rstatus,CheckIn,CheckOut,CustomerID,FirstName,LastName,Address,City,State,PostalCode,Phone,TransferType,TransferDate,Item,Description,Quantity,Rate,Price,Discount,Channel,RateType,ChannelNotes,UserNotes,CreateBy,CreateDate,ModifyBy,ModifyDate)
NOT IN (SELECT ChargeID,FolioID,Rstatus,CheckIn,CheckOut,CustomerID,FirstName,LastName,Address,City,State,PostalCode,Phone,TransferType,TransferDate,Item,Description,Quantity,Rate,Price,Discount,Channel,RateType,ChannelNotes,UserNotes,CreateBy,CreateDate,ModifyBy,ModifyDate FROM ImportCSV))
AND FolioID IN (SELECT DISTINCT FolioId FROM ImportCSV AS FolioID ORDER BY FolioID)
AND FolioID != 0
AND TransferDate > (SELECT min(TransferDate) FROM ImportCSV)
AND DBRStatus = 'Active'
)";
/// TODO: Add eMail scripting here
/// Run deadify/deprecation routine on records
$deadify_stmt = $pdo->prepare($deadify);
$deadify_stmt->execute() or die(print_r($insert->errorInfo(), true));
$deadify_count = $deadify_stmt->rowCount();
$fileName = "../../data/[login to view URL]";
$fileDate=date ("Y-m-d H:i:s.", filemtime($fileName));
$imported = "UPDATE Resync SET Deadified = $deadify_count WHERE Fdate = '$fileDate'";
$imported_stmt = $pdo->prepare($imported);
$imported_stmt->execute() or die(print_r($insert->errorInfo(), true));