Questions about PHP combined with HTML table query data summary rows or columns

Source: Internet
Author: User
Questions about PHP combined with HTML table query data summary rows or columns
One of the reports:


PHP reads data from MSSQL, and the total line is calculated in what way.

This is part of the code, such as the amount required for the sum of a column, the last line of the table shows the total in what way to show and calculate, thank you veteran advice!!
$query = "SELECT Top  a.branchdesc,sum (b.amount) Total
From Basebranch A Inner joins Retail B on A.branchid=b.branchid
Where b.doneflag=1 and B.delflag=0 and retailtype<>1 and Convert (varchar (), b.workdate,112) = ' $searchdata '
Group by A.branchdesc ORDER by total DESC ";

echo "$searchdata sales:";
echo "



"; Echo" "; while ($row = Mssql_fetch_array ($result)) echo " "; Echo"
Stores Amount
$row [0] $row [1]
";

------to solve the idea----------------------
$total = Array (' Total ', 0);
while ($row = Mssql_fetch_array ($result)) {
echo "$row [0] $row [1]";
$total [1] + = $row [1];
}
echo "$total [0] $rotal [1]";
echo "";
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.