-
Notifications
You must be signed in to change notification settings - Fork 0
/
bitcoinusd.php
95 lines (72 loc) · 1.87 KB
/
bitcoinusd.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
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
<?php
include 'config.php';
$btceusd5 = array();
$bfnxusd4 = array();
$btceusd12 = array();
$bfnxusd12 = array();
$sql = "SELECT * FROM btcedata";
if($result = mysqli_query($link, $sql)){
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_array($result)){
$btceusd4 = $row['btcprice'];
$btceusd5[] = $btceusd4;
$btceusd13 = $row['btcopen'];
$btceusd12[] = $btceusd13;
}
mysqli_free_result($result);
} else{echo "No records matching your query were found.";}
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
$sql = "SELECT * FROM bitfinexdata";
if($result = mysqli_query($link, $sql)){
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_array($result)){
$bfnxusd5 = $row['btcprice'];
$bfnxusd4[] = $bfnxusd5;
$bfnxusd13 = $row['btcopen'];
$bfnxusd12[] = $bfnxusd13;
}
mysqli_free_result($result);
} else{echo "No records matching your query were found.";}
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
mysqli_close($link);
$btceusd6 = end($btceusd5);
$bfnxusd6 = end($bfnxusd4);
$btceusd11 = end($btceusd12);
$bfnxusd11 = end($bfnxusd12);
$btceusd = $btceusd6;
$bfxusd = $bfnxusd6;
$btceusd2 = $btceusd11;
$bfxusd2 = $bfnxusd11;
if ( $btceusd >= $btceusd2 )
{
$arw1 = "▴";
$color1 = "green";
}
else
{
$arw1 = "▾";
$color1 = "red";
}
if ( $bfxusd >= $bfxusd2 )
{
$arw2 = "▴";
$color2 = "green";
}
else
{
$arw2 = "▾";
$color2 = "red";
}
echo "<li><a href=\"\" >";
echo "<span class=\"txtlf\">BTC-E</span>";
echo "<span class=\"txtlr\" style=\"color:$color1;\" >$btceusd USD</span>";
echo "<span class=\"arws\" style=\"color:$color1;\" >$arw1</span></a></li>";
echo "<li><a href=\"\" >";
echo "<span class=\"txtlf\">BITFINEX</span>";
echo "<span class=\"txtlr\" style=\"color:$color2;\" >$bfxusd USD</span>";
echo "<span class=\"arws\" style=\"color:$color2;\" >$arw2</span></a></li>";
?>