-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraphtry.php
More file actions
82 lines (68 loc) · 1.43 KB
/
graphtry.php
File metadata and controls
82 lines (68 loc) · 1.43 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
<html>
<head>
</head>
<body>
<?php
$conn=mysqli_connect("localhost","root","");
$sql="use delhimetro";
$conn->query($sql);
?>
hii there
<script type='text/javascript'>
<?php
echo"var node= [ ";
$out=0;
while($out<248)
{
$in=0;
echo "[ ";
while($in<247)
{
echo "0,";
$in++;
}
echo"0]";
if($out<247)
echo",";
$out++;
}
echo"];";
$sql="SELECT `code`, `Station_name`, `node1`, `dist1`, `node2`, `dist2`, `node3`, `dist3`, `node4`, `dist4` FROM `table 3` WHERE 1 ;";
$res=$conn->query($sql);
if($res->num_rows>0)
{
while($row=$res->fetch_assoc())
{
if($row["node1"]!=NULL)
{
$r=$row['code']-1;
$c=$row['node1']-1;
echo "node[".$r."][".$c."]=".$row['dist1'].";";
echo "\n";
}
if($row["node2"]!=NULL)
{
$r=$row['code']-1;
$c=$row['node2']-1;
echo "node[".$r."][".$c."]=".$row['dist2'].";";echo "\n";
}
if($row["node3"]!=NULL)
{
$r=$row['code']-1;
$c=$row['node3']-1;
echo "node[".$r."][".$c."]=".$row['dist3'].";";echo "\n";
}
if($row["node4"]!=NULL)
{
$r=$row['code']-1;
$c=$row['node4']-1;
echo "node[".$r."][".$c."]=".$row['dist4'].";";echo "\n";
}
}
}
?>
</script>
<script>
console.log(node);
</script>
</body>