-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase_table_extraction.php
More file actions
110 lines (102 loc) · 3.52 KB
/
database_table_extraction.php
File metadata and controls
110 lines (102 loc) · 3.52 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<html>
<body>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname="nbsu_tiet";
$conn = mysqli_connect($servername, $username, $password,$dbname);
if (!$conn)
die("Connection failed: " . mysqli_connect_error());
else
;
$total=0;
for($i=1;$i<=22;$i++)
{
$sql="SELECT district,newborn_entries FROM dist_data WHERE u_no=$i";
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result)>0)
{
$j=0;
while($row=mysqli_fetch_assoc($result))
{
$a=$row['district'];
$b[$j]=$row['newborn_entries'];
$j++;
}
}
else
{
echo "no rows found";
}$j--;
$ba=0;
for($x=0; $x<=$j; $x++)
{
$ba += $b[$x];
}
for($x=0; $x<=$j; $x++)
{
$total += $b[$x];
}
$sum[$i]=$ba;
}
for($i=1;$i<=22;$i++)
{
$sum1[$i]=($sum[$i]/$total)*100;
}
mysqli_close($conn);
?>
<h1>Graphical Representation</h1><br>
<script>
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
title: {
text: "District Wise Information 0f Total Entries"
},
axisX: {
interval: 1
},
axisY2: {
interlacedColor: "rgba(1,77,101,.2)",
gridColor: "rgba(1,77,101,.1)",
title: "Percentage admissions in NBSU"
},
data: [{
type: "bar",
name: "companies",
axisYType: "secondary",
color: "#014D65",
dataPoints: [
{ y: <?php echo $sum1[1]; ?>, label: "Amritsar" },
{ y: <?php echo $sum1[2]; ?>, label: "Barnala" },
{ y: <?php echo $sum1[3]; ?>, label: "Bathinda" },
{ y: <?php echo $sum1[4]; ?>, label: "Faridkot" },
{ y: <?php echo $sum1[5]; ?>, label: "Fatehgarh" },
{ y: <?php echo $sum1[6]; ?>, label: "Ferozpur" },
{ y: <?php echo $sum1[7]; ?>, label: "Fazilka" },
{ y: <?php echo $sum1[8]; ?>, label: "Gurdaspur" },
{ y: <?php echo $sum1[9]; ?>, label: "Hoshiarpur" },
{ y: <?php echo $sum1[10]; ?>, label: "Jalandhar" },
{ y: <?php echo $sum1[11]; ?>, label: "Kapurthala" },
{ y: <?php echo $sum1[12]; ?>, label: "Ludhiana" },
{ y: <?php echo $sum1[13]; ?>, label: "Mansa" },
{ y: <?php echo $sum1[14]; ?>, label: "Moga" },
{ y: <?php echo $sum1[15]; ?>, label: "Shiv Mukstar Sahib" },
{ y: <?php echo $sum1[16]; ?>, label: "Pathankot" },
{ y: <?php echo $sum1[17]; ?>, label: "Patiala" },
{ y: <?php echo $sum1[18]; ?>, label: "Rupnagar" },
{ y: <?php echo $sum1[19]; ?>, label: "Mohali" },
{ y: <?php echo $sum1[20]; ?>, label: "Sangrur" },
{ y: <?php echo $sum1[21]; ?>, label: "Nawanshahr" },
{ y: <?php echo $sum1[22]; ?>, label: "Tarn Taran" }
]
}]
});
chart.render();
}
</script>
<div id="chartContainer" style="height: 370px; width: 100%;"></div>
<script src="canvasjs.min.js"></script>
</body>
</html>