<?php
require('include/functions.php');
$cid = 25275;
$convo = sb_db_get('SELECT * FROM sb_conversations WHERE id = ' . $cid);
if ($convo) {
    echo "Conversation Found: " . json_encode($convo) . "\n";
    $activetime = $convo['creation_time']; // Base
    
    // Last message
    $last_msg = sb_db_get('SELECT * FROM sb_messages WHERE conversation_id = ' . $cid . ' ORDER BY id DESC LIMIT 1');
    if ($last_msg) {
        echo "Last Message: " . $last_msg['message'] . " (Time: " . $last_msg['creation_time'] . ")\n";
        echo "Last Msg User ID: " . $last_msg['user_id'] . "\n";
    } else {
        echo "No messages found.\n";
    }
} else {
    echo "Conversation $cid NOT FOUND.\n";
}
?>
