I want to create a line chart like this one(see Below) but I want to use the data from the sql page also below.
/////////////----------------Page with sql data-------------------------------------//////
<!DOCTYPE html>
<html lang="en">
<head>
<title>DashBoard</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<style>
table {
border: 1px solid #B0CBEF;
border-width: 1px 0px 0px 1px;
font-size: 14pt;
font-family: Calibri;
font-weight: 100;
border-spacing: 0px;
border-collapse: collapse;
}
TH {
background-image: url(excel-2007-header-bg.gif);
background-repeat: repeat-x;
font-weight: normal;
font-size: 17px;
border: 1px solid #9EB6CE;
border-width: 0px 1px 1px 0px;
height: 17px;
}
TD {
border: 0px;
padding: 0px 4px 0px 2px;
border: 1px solid #D0D7E5;
border-width: 0px 1px 1px 0px;
}
TD B {
border: 0px;
background-color: white;
font-weight: bold;
}
TD.heading {
background-color: #E4ECF7;
text-align: center;
border: 1px solid #9EB6CE;
border-width: 0px 1px 1px 0px;
}
</style>
<?php
$grandTotal = 0;
$connect =odbc_connect("removed");
if(!$connect) {
exit("Connection Failed: " . $connect);
}
$sql=" SELECT
CONVERT(CHAR(4), ompOrderDate, 120) as year
, CONVERT(CHAR(2), ompOrderDate, 101) as month
, sum( ompOrderSubtotalBase)as total
FROM m1_KF.dbo.SalesOrders Left Join
m1_KF.dbo.Organizations on SalesOrders.ompCustomerOrganizationID = Organizations.cmoOrganizationID left Join
m1_KF.dbo.Employees on lmeEmployeeID = cmoAccountManagerEmployeeID Left Join
m1_KF.dbo.OrganizationLocations on Organizations.cmoOrganizationID = OrganizationLocations.cmlOrganizationID and
SalesOrders.ompShipLocationID = OrganizationLocations.cmlLocationID
Where ompOrderDate > '01-01-2013' and lmeEmployeeID = 'MF001' and ompClosed =-1
group by lmeEmployeeID
,CONVERT(CHAR(2), ompOrderDate, 101), CONVERT(CHAR(4), ompOrderDate, 120)
order by year, month ";
$result =odbc_exec($connect,$sql);
if(!$result){
exit("Error in SQL");
}
#echo "SalesPerson Total". date("m-d-Y") ;
echo "<table><tr>";
echo "<th>Year</th>";
echo "<th> </th>";
echo "<th>Month</th>";
echo "<th> </th>";
echo "<th>Total</th></tr>";
while (odbc_fetch_row($result)) {
$year=odbc_result($result,"year");
$month=odbc_result($result,"month");
$total=odbc_result($result,"total");
$num = number_format($total, 2, '.', ',');
$grandTotal += $total;
echo "<tr><td>$year</td>";
echo "<td> ◃ </td>";
echo "<td>$month</td>";
echo "<td> ▹ </td>";
echo "<td>$num</td>";
# echo "<td align='right'>$num</td></tr>";
}
#$num2 = number_format( $grandTotal, 2);
#echo "Grand Total: $num2";
odbc_close($connect);
?>
</body>
</html>