I am fetching records from database and want to get the total sum of salary paid to each user via PHP.
I want to get the sum of salary using PHP but not via backend. How can I do it?
I want to get the sum of salary using PHP but not via backend. How can I do it?
<?php
include('conn.php');
$result =mysql_query("select * from tbl_test")
or die(mysql_error());
echo "<table cellpadding = '10'>";
echo "<tr>
<th>id:</th>
<th>name:</th>
<th>salary:</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo '<td>'.$row['userid'].'</td>';
echo '<td>'.$row['username'].'</td>';
echo '<td>'.$row['salary'].'</td>';
}
?>