Massive escrow update; also fixes #3

This commit is contained in:
Pinga 2023-12-01 13:33:05 +02:00
parent 28c68a4e57
commit 42ddc29df6
2 changed files with 289 additions and 98 deletions

View file

@ -42,8 +42,16 @@ function setupLogger($logFilePath, $channelName = 'app') {
}
function fetchCount($pdo, $tableName) {
$stmt = $pdo->prepare("SELECT count(id) AS count FROM {$tableName};");
// Calculate the end of the previous day
$endOfPreviousDay = date('Y-m-d 23:59:59', strtotime('-1 day'));
// Prepare the SQL query
$query = "SELECT COUNT(id) AS count FROM {$tableName} WHERE crdate <= :endOfPreviousDay";
$stmt = $pdo->prepare($query);
$stmt->bindParam(':endOfPreviousDay', $endOfPreviousDay);
$stmt->execute();
// Fetch and return the count
$result = $stmt->fetch();
return $result['count'];
}