PROBLEM: Mysql + arduino + dth11

PROBLEM: Mysql + arduino + dth11

Hi
I have a big problem with passing data captured by the DTH11 (temperature) sensor to mysql
when it connects the arduino board it is all normal, it says: Connected but in the database there is no data. please if you could guide me with this. Thanks a lot

ARDUINO.ino
#include <dht.h>

#include <Ethernet.h>
#include <SPI.h>

// INTERNET EN LA TARJETA DE RED
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress server (192, 168, 1, 4);
IPAddress subnet (255, 255, 255, 0);
IPAddress gateway (0, 0, 0, 0);
IPAddress ip (192, 168 , 1, 30);

EthernetClient client;

//#define dht_apin A0 // Analog Pin sensor is connected to

dht DHT;

float temperatura;
int analog_pin = A0;

//Configuracion de Arduino
void setup() {
Serial.begin(9600);
while (!Serial)
{
;
}

//Inicializa el dispositivo de Ethernet
Ethernet.begin(mac, ip);
delay(1000);
}

void loop() {
DHT.read11(analog_pin);
temperatura = DHT.temperature;

Serial.print(temperatura);
Serial.println(" °C");

Serial.println("Connecting...");
if (client.connect(server, 80)>0) {
Serial.println("Connected");
client.print(" GET /Ethernet.php?=temp=");
client.print(temperatura);
client.println(" HTTP/1.1");
client.println("Host: ");
client.println("Connection: close");
client.println();
Serial.println("Conectado");
} else {
Serial.println("Fallo en la conexion");
}
if (!client.connected()) {
Serial.println("Desconectado!");
client.stop();
}
}

ETHERNET.php

<?php $temp = $GET["temp"]; $enlace = mysqli_connect('localhost','root','','conexion') or die ('No se puede conectar: ' .mysql_error()); echo 'Conexion exitosa '; echo 'Se ingresaron los datos '; echo ' '; echo 'Dato: '.$temp; echo ' '; $consulta = mysql_query($enlace, "INSERT INTO temperatura (temp) VALUES ($temp)"); if (!$consulta) { echo "Error al guardar "; } else { echo "Datos guardados "; } echo ' '; ?>

thank you very much :slight_smile:

I've deleted your other cross-post @francogt80000.

Cross-posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes (or more) writing a detailed answer on this topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting will result in a suspension from the forum.

In the future, please take some time to pick the forum board that best suits the topic of your question and then only post once to that forum board. This is basic forum etiquette, as explained in the sticky "How to use this forum - please read." post you will find at the top of every forum board. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

help me please to problem
thanks :slight_smile:

Have you tested the PHP script from a browser so that you know it work as expected?