<?php
function notify(
    PDO $pdo,
    int $user_id,
    string $title,
    string $message,
    string $type = 'general',
    string $url = null,
    int $reference_id = null
) {

    $stmt = $pdo->prepare("
        INSERT INTO notifications 
        (user_id, title, message, type, url, reference_id)
        VALUES (?,?,?,?,?,?)
    ");

    $stmt->execute([
        $user_id,
        $title,
        $message,
        $type,
        $url,
        $reference_id
    ]);
}