Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

getting sum of records fetched from backend via PHP

$
0
0
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?
<?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>';
		}
	?>

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>