Without count find total sum in PHP MYSQL while in while loop

Description

Calculate row sum variable total and count without used mysql count queary in mysql php with while loop and while loop with table 2 or 3 while loop used php mysql queries 

How to count column row values with MySQL queries ount(*)  mysql - Calculate row SQL COUNT for total number of records in mysql table php sum variable in while loop

 

How to Get and count number of rows in result mysql_num_rows

Count and sum in mysql and php

<?php

$summgbta=0;

$techwiteachtechdda = mysql_query("SELECT * FROM managebatchtimeadd where roomidlist = '".$selectroomid."' ");

while($techwicddersbr=mysql_fetch_array($techwiteachtechdda)){       

   $managelist = $techwicddersbr['managebatchid'];

$techwicddda = mysql_query("SELECT * FROM manageadminbatchlist where batchcode = '".$managelist."' ");

$checknonn = mysql_num_rows($techwicddda);

echo $checknonn;

 $summgbta = $summgbta + $checknonn;

//echo $summgbta;

while($techwicddersbra=mysql_fetch_array($techwicddda)){

//$techwicddersbr = mysql_fetch_array($techwicddda);

     // $summgbta = $summgbta + $checknonn;

//echo $summgbta;

    //echo $techwicddersbra['adminid'];

//echo $techwicddersbra['batchcode'];

     }

}

echo $summgbta; 

?>