11-06-2012, 07:13 PM
Please help me to do the sum of the columns of a row : php mysql
The codes are below but I am not getting any result.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>salary222</title>
</head>
<body>
<?php
include connectsl.php;<--database connection -->
$sum=0;
$r = mysql_query('SELECT basic+houserent+increment+medical+children+convence+washing+superanfund1+personalpay+entertainment+
faculty+chairman+domestic+hill+others+exgratia FROM salary');
while ($row = mysql_fetch_array($r))
{
print $sum += $row[0];
}
?>
</body>
</html>
The codes are below but I am not getting any result.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>salary222</title>
</head>
<body>
<?php
include connectsl.php;<--database connection -->
$sum=0;
$r = mysql_query('SELECT basic+houserent+increment+medical+children+convence+washing+superanfund1+personalpay+entertainment+
faculty+chairman+domestic+hill+others+exgratia FROM salary');
while ($row = mysql_fetch_array($r))
{
print $sum += $row[0];
}
?>
</body>
</html>