I have a considerable problem: - I want to list a search for a function that counts. I want it to be displayed by the value of notifications
Thenotificationcountismadefromthefollowingcode:
functioncount_reports_where_id($conn,$id){//$cmd="SELECT DISTINCT blogger_id FROM reports;";
$cmd = "SELECT blogger_id FROM reports WHERE blogger_id = '$id'";
$produtos = mysqli_query($conn,$cmd) or die(mysqli_error($conn));
$total = mysqli_num_rows($produtos);
return $total;
}
Listingcode:
$result=mysqli_query($conn,"SELECT DISTINCT blogger_id from reports ORDER BY ?????/;") or die(mysqli_error($conn));
echo
"<table border='1' padding='111'>
<tr>
<th>Blogger ID</th>
<th>Notificações</th>
<th>Opções</th>
</tr>";
while($row = mysqli_fetch_assoc($result))
{
echo "<tr>";
echo "<td>" . $row['blogger_id'] . "</td>";
echo "<td>" . count_reports_where_id($conn, $row['blogger_id']) . "</td>";
echo "<td><a href='admin_report.php?id=". $row['blogger_id'] ."'>Verificar</a></td>";
echo "</tr>";
}
echo "</table>";
How to sort the list by count_reports_where_id? do you need blogger_id to count?