-
Notifications
You must be signed in to change notification settings - Fork 0
/
stud_financial_condition.php
44 lines (42 loc) · 1.28 KB
/
stud_financial_condition.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<html>
<head>
<title>Student Financial status</title>
</head>
<body>
<?php
$username = "root";
$password = "";
$hostname = "localhost";
$entry="";
//connect to database
$con = mysqli_connect($hostname, $username, $password, "educon");
echo "Connected to MySQL<br>";
$result = mysqli_query($con, "SELECT * FROM stud_economicgraph");
//fetch data
while ($row = mysqli_fetch_array($result)) {
$entry .= "['".$row{'year'}."',".$row{'financial_status'}."],";
}
//close the connection
mysqli_close($con);
?>
<div id="chart_div" style="width: 100%; height: 500px;"></div>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['year', 'financial_status'],
<?php echo $entry ?>
]);
var options = {
title: 'Student Financial status',
curveType: 'function',
legend: { position: 'bottom' }
};
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</body>
</html>