setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch(PDOException $e) { die("Connection Error: " . $e->getMessage()); } $stats = ['opens' => 0, 'clicks' => 0, 'leads' => 0, 'unsubscribes' => 0, 'optouts' => 0, 'total' => 0]; $tables = ['opens', 'clicks', 'leads', 'unsubscribes', 'optouts']; foreach($tables as $table) { try { $stmt = $pdo->query("SELECT COUNT(*) as count FROM actions.$table"); $row = $stmt->fetch(PDO::FETCH_ASSOC); $stats[$table] = intval($row['count']); $stats['total'] += $stats[$table]; } catch(Exception $e) {} } $recent = []; try { $stmt = $pdo->query("SELECT 'OPEN' as type, created_at, process_id FROM actions.opens ORDER BY created_at DESC LIMIT 50"); $recent = $stmt->fetchAll(PDO::FETCH_ASSOC); } catch(Exception $e) {} ?>
Last update: