<ul>
<?php
while( ($cat = mysqli_fetch_assoc($result)) )
{
$articles_count = mysqli_query($conection, 'SELECT * FROM `articles` WHERE `categories_id` = ' . $cat['id'] );
echo '<li>' . $cat['name'] . '('. mysqli_num_rows($articles_count).') </li>';
}
?>
</ul>
echo '<li>' . $cat['name'] . '('. mysqli_num_rows($articles_count).') </li>';
while( ($cat = mysqli_fetch_assoc($result)) )
{
if ($articles_count = mysqli_query($conection, "SELECT * FROM `articles` WHERE `categories_id`='".mysqli_real_escape_string($connection, $cat['id'])."'"))
{
echo '<li>' . $cat['name'] . ' ('. mysqli_num_rows($articles_count).') </li>';
}
}
mysqli_real_escape_string()
).