Member 13143008 Ответов: 0

Php sub total и все итоги


<html>   
<head>    
</head>  
<body>  
<?php
	include('connection.php');
	$sql = mysqli_query($connection,"SELECT COALESCE(Customer.CustomerID, 'Sub Total') AS CustomerID, 
									Customer.CusName,  
									CusGroup.groupId, 
									Customer.CreditAllowed,
									SUM(Customer.CreditAllowed) AS total
									FROM Customer INNER JOIN CusGroup ON Customer.GroupID=CusGroup.groupId 
									GROUP BY CusGroup.groupId ,Customer.CustomerID with rollup");
	echo '<table border="1" align="center" width="80%">
			<thead>
				<tr>
					<td>CustomerId</td>
					<td>CustomerName</td>
					<td>Group Id</td>
					<td>CreditLimit</td>
					<td>Total</td>
				</tr>
			</thead>
			<tbody>';
	$total = 0;
	while($row=mysqli_fetch_array($sql,MYSQLI_ASSOC)){
		echo '<tr>
				<td>'.$row['CustomerID'].'</td>
				<td>'.$row['CusName'].'</td>
				<td>'.$row['groupId'].'</td>
				<td>'.$row['CreditAllowed'].'</td>
				<td>'.number_format($row['total']).'</td>
			  </tr>';
		$total +=$row['total'];
	}
		'</tbody>
		</table>';	
?> 
</body>  
</html>  


Что я уже пробовал:

i want sub total and all the totals of the sub total.but in sub total row i get unnecessary data allso plz check this and help me im new to programming.

0 Ответов