Guest User

Untitled

a guest
Mar 18th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. <?php
  2. //Database login variables
  3. $dbusername = "id5096752_root";
  4. $dbpassword = "***";
  5. $host = "localhost";
  6. $mydb = "id5096752_disspill";
  7. //Connect to database
  8. $con = new mysqli ($host, $dbusername, $dbpassword);
  9. if($con)
  10. {
  11. echo "Connection succesful";
  12. }
  13. else
  14. {
  15. echo "Connection error";
  16. }
  17. mysqli_select_db($con,$mydb) or die
  18. ("Database selection error");
  19.  
  20. //Query
  21. $SQL = "UPDATE contenedores SET ocupado='$_GET[ocupado]', nombrePastilla='$_GET[nombrePastilla]', cantidadPastillas = '$_GET[cantidadPastillas]' WHERE numeroContenedor = '$_GET[numeroContenedor]'";
  22. //Execute query
  23. mysqli_query($con,$SQL);
  24. ?>
  25.  
  26. byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x19 };
  27. char bdServer[] = "disspill.000webhostapp.com";
  28.  
  29. ...
  30.  
  31. Ethernet.begin(mac);
  32. client.stop();
  33. Serial.println("Connecting with BD");
  34. if(client.connect(bdServer, 80))
  35. {
  36. Serial.println("Connected");
  37. client.print("GET /phpcommands/updateData.php?numeroContenedor=1&ocupado=si&nombrePastilla=paracetamol&cantidadPastillas=7");
  38. client.println(" HTTP:/1.0");
  39. client.println("Host: disspill.000webhostapp.com");
  40. client.println("Connection: close");
  41. client.println();
  42. client.stop();
  43. }
  44. else
  45. {
  46. Serial.println("Error");
  47. }
Add Comment
Please, Sign In to add comment