As a developer, We need to count rows from multiple table in a single query.
In this tutorial, I will show you how can you do that –
I am writing it Codeigniter format, but you can use this query in procedural way.
$query = "SELECT (SELECT COUNT(id) FROM table1) AS num1,
(SELECT COUNT(id) FROM table2) AS num2,
(SELECT COUNT(id) FROM table3) AS num3";
$result = $this>db->query($query)->row();
You can also use where condition here to get more necessary info..