PHP Tutorial - How to dynamically show how many mysql queries have been executed on a page?

I have a PHP page that could potentially result in a lot of mySQL queries depending on what the user searches. For searches that will take a long time, I want to show the user that something is happening, so they don't think the page is broken or hanging. I can't make a progress bar because I do not know how many queries will be executed every time. It depends on the search. I was thinking of having a number on the side of the page that would correspond to the number of queries and this number would increase continuously until the search is over.
This is how I am executing my queries.
$query = "SELECT name, id, direct_owner FROM $table WHERE parent_id = '$ownerID'";
$result = mysqli_query($connection, $query);
I am submitting a form for each search and then I use
if(isset($_POST['submit'])

Answer:

PHP is server-side, it will not be able to show anything in realtime, you'd need client-side like Javascript or Angular or Jquery for any frameworks.
I "lied" a bit, you can do real-time, but it's very hackish. You can read about flush() here. I wouldn't recommend it, and regardless, you can't do a progress bar with just PHP.
What you should do is create this PHP file as a postRequest type and query it using AJAX, which is capable of doing live-output and a progress bar. There are multiple libraries out there to help you.