Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "ticker";
- $password = "34a05w00";
- $dbname = "ticker";
- $query = "select id, cloakprice, btcprice, from_unixtime(timestamp, '%h:%i') as readdate from price order by id asc limit 10 ";
- $conn = new mysqli($servername, $username, $password, $dbname);
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- } echo "Connected successfully";
- echo ("<br>");
- $result = $conn->query($query);
- if ($result->num_rows > 0) {
- $price1 = 0;
- $difference = 0;
- while($row = $result->fetch_assoc()) {
- echo ("<tr>");
- if ($price1 != 0) {
- $difference = round(($row["btcprice"] - $price1),2);
- }
- $price1 = $row["btcprice"];
- echo ("<th class='data'>") . $row["id"]. ("</th><th class='data'>") . $row["cloakprice"]. ("</th>  <th class='data'>") . $row["btcprice"]. ("</th> <th class='data'>"). $row["readdate"]. "</th> <th class='data'> $difference </th> </tr>";
- // echo ("<br>");
- }
- } else {
- echo "0 results";
- }
- $conn->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement