Intro_basicos_HTML_CSS/Simple_IOT_WebServer/conexion.php
2020-11-18 02:09:41 -03:00

29 lines
1.0 KiB
PHP
Executable File

<?php
$servidor = "192.168.0.10";
$usuario = "esp1";
$bd = "pruebadb";
$tabla = "GARDENER";
$clave = "*******";
$id = $_POST["id"];
$fecha = $_POST["fecha"];
$hum1 = $_POST["hum1"];
$hum2 = $_POST["hum2"];
$hum3 = $_POST["hum3"];
$hum4 = $_POST["hum4"];
$tempsup = $_POST["tempsup"];
$humsup = $_POST["humsup"];
$tempinf = $_POST["tempinf"];
$huminf = $_POST["huminf"];
$tempext = $_POST["tempext"];
$humext = $_POST["humext"];
$conexion = new mysqli($servidor, $usuario, $clave, $bd);
$conexion->begin_transaction();
$pst = $conexion->prepare("INSERT INTO GARDENER(id,fechaBG,hum1,hum2,hum3,hum4,tempsup,humsup,tempinf,huminf,tempext,humext) values(?,?,?,?,?,?,?,?,?,?,?,?)");
//bind_param recive i=enteros d=double o decimal s=cadena b=boolean
$pst->bind_param('isiiiidididi',$id,$fecha,$hum1,$hum2,$hum3,$hum4,$tempsup,$humsup,$tempinf,$huminf,$tempext,$humext);
$pst->execute();
$conexion->commit();
echo "<a href='index.html'>Datos Enviados, Volver</a>";
?>