Getting a percentage of one PHP variable from another
<p>I am trying to get a percentage of a php variable from another, for example i have two databases of information, the first database is full of unidentified information.  The second database is full of the information we have identified. and so i want to work out dynamically the percentage of the total information identified.</p>

<p>Below is a php function to work out a percentage, </p>

<pre><code>//TOTAL ENTRIES INTO Table 1 FOR total data
$result   = mysql_query( "SELECT * FROM table1" );
$num_total = mysql_num_rows( $result );

 //TOTAL ENTRIES IN Table 2  FOR THE PERCENTAGE
$result   = mysql_query( "SELECT * FROM table2" );
$num_amount = mysql_num_rows( $result );

 function percent($num_amount, $num_total) {
 $count1 = $num_amount / $num_total;
 $count2 = $count1 * 100;
 $count3 = 100 - $count2;
 $count = number_format($count3, 0);
 echo $count;
 }
</code></pre>

<p>Both queries return the correct information of the total number of rows counted in the database, however  the count variable does not return any information.  </p>

<p>Any ideas or suggestions would be appreciated.</p>

<p>Thanks</p>

<p>Stan</p>
