<?php
define('_ECRIRE_INC_VERSION', '1');
$conn = mysqli_connect('localhost', 'root', '', 'umucyoradio_new');
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}

echo "=== RUBRIQUES ===\n";
$res = mysqli_query($conn, "SELECT id_rubrique, id_parent, titre FROM spip_rubriques");
while ($row = mysqli_fetch_assoc($res)) {
    echo "ID: {$row['id_rubrique']} | Parent: {$row['id_parent']} | Title: {$row['titre']}\n";
}

echo "\n=== ARTICLES IN RUBRIQUE 8 & DESCENDANTS ===\n";
$res = mysqli_query($conn, "SELECT id_article, id_rubrique, titre FROM spip_articles WHERE id_rubrique = 8 OR id_rubrique IN (SELECT id_rubrique FROM spip_rubriques WHERE id_parent = 8)");
while ($row = mysqli_fetch_assoc($res)) {
    echo "ID: {$row['id_article']} | Rubrique: {$row['id_rubrique']} | Title: {$row['titre']}\n";
}

mysqli_close($conn);
?>
