Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. <?php
  2. ini_set("display_errors", 1);
  3. error_reporting(E_ALL);
  4.  
  5. $encoded_body = isset($_POST['body']) ? $_POST['body'] : '';
  6. $body = urldecode($encoded_body);
  7. $vars = explode(' ', $body);
  8.  
  9. $vid = $vars[1];
  10.  
  11. echo "Number is $body";
  12.  
  13. $con=mysqli_connect("phpmyadminserver","username","password","databasename");
  14. //Check connection
  15.  
  16. if (mysqli_connect_errno())
  17. {
  18. echo "Failed to connect to MySQL: " . mysqli_connect_error();
  19. }
  20. else
  21. {
  22. $sql = "UPDATE GasReadings SET Gas_Value='".$vid."' WHERE id=0";
  23. }
  24.  
  25. if (!mysqli_query($con,$sql))
  26. {
  27. die('Error: ' . mysqli_error($con));
  28. }
  29.  
  30. mysqli_close($con);
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement