Guest User

Untitled

a guest
Jun 2nd, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. <?php
  2. $server = "localhost";
  3. $username ="XXXXX";
  4. $password = "XXXXX";
  5. $database = "XXXX";
  6.  
  7. $conn = mysqli_connect($server,$username,$password,$database);
  8. $dataNewCount = $_POST['dataNewCount'];
  9.  
  10.  
  11. $sql = "SELECT bid,ask,curr_pair FROM wp_ticker WHERE wp_ticker.curr_pair = '$dataNewCount' LIMIT 1";
  12.  
  13. $result = mysqli_query($conn, $sql);
  14. if (mysqli_num_rows($result) > 0) {
  15. while ($row = mysqli_fetch_assoc($result)){
  16. $val1 = $row['bid'];
  17. }
  18. }
  19.  
  20. mysqli_free_result($result);
  21.  
  22. $dataNewCountfirst3 = substr($dataNewCount, -3, 3);
  23. if ($dataNewCountfirst3 !== "EUR"){
  24. $geteuro = $dataNewCountfirst3."EUR";
  25. }
  26.  
  27.  
  28. $sql = "SELECT bid,ask,curr_pair FROM wp_ticker WHERE wp_ticker.curr_pair = '$geteur' LIMIT 1";
  29. $result = mysqli_query($conn, $sql);
  30. if (mysqli_num_rows($result) > 0){
  31. //echo $result2->bid;
  32. while($row = mysql_fetch_assoc($result)){
  33. $val2 =$row['bid'];
  34. }
  35. }
  36.  
  37. mysqli_close($conn);
  38.  
  39. $data = ["$val1", "$val2"];
  40. echo json_encode($data);
Add Comment
Please, Sign In to add comment