Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Database login variables
- $dbusername = "id5096752_root";
- $dbpassword = "***";
- $host = "localhost";
- $mydb = "id5096752_disspill";
- //Connect to database
- $con = new mysqli ($host, $dbusername, $dbpassword);
- if($con)
- {
- echo "Connection succesful";
- }
- else
- {
- echo "Connection error";
- }
- mysqli_select_db($con,$mydb) or die
- ("Database selection error");
- //Query
- $SQL = "UPDATE contenedores SET ocupado='$_GET[ocupado]', nombrePastilla='$_GET[nombrePastilla]', cantidadPastillas = '$_GET[cantidadPastillas]' WHERE numeroContenedor = '$_GET[numeroContenedor]'";
- //Execute query
- mysqli_query($con,$SQL);
- ?>
- byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x19 };
- char bdServer[] = "disspill.000webhostapp.com";
- ...
- Ethernet.begin(mac);
- client.stop();
- Serial.println("Connecting with BD");
- if(client.connect(bdServer, 80))
- {
- Serial.println("Connected");
- client.print("GET /phpcommands/updateData.php?numeroContenedor=1&ocupado=si&nombrePastilla=paracetamol&cantidadPastillas=7");
- client.println(" HTTP:/1.0");
- client.println("Host: disspill.000webhostapp.com");
- client.println("Connection: close");
- client.println();
- client.stop();
- }
- else
- {
- Serial.println("Error");
- }
Add Comment
Please, Sign In to add comment