Need a Website Or Web Application Or Any Help In Code , Contact Us: +91 9437911966 (Whatsapp), Note: Paid Service
Students Tutorial app relased. Download Now.

How to show total amount month and year wise PHP


	die('Could not Connect My Sql:' .mysql_error());


$result = mysqli_query($conn,"select year(date) as year, month(date) as month, sum(paid) as total_amount
from amount_table
group by year(date), month(date)");
<!DOCTYPE html>
<html lang="en">
  <title>How to show total amount month and year wise PHP</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="">

<div class="container">
    <table class="table table-bordered">
	while($row = mysqli_fetch_array($result)) {
	$monthNum  = $row["month"];
	$dateObj   = DateTime::createFromFormat('!m', $monthNum);
	$monthName = $dateObj->format('F');
				<td><?php echo $row["year"]; ?></td>
				<td><?php echo $monthName; ?></td>
				<td><?php echo $row["total_amount"]; ?></td>