Temperature Sensor to Database

Hi I’m trying to create a Status that says if the temperature hits the high temperature it will record it in my database and if it hits a low temperature it will also send data to my database and display it to my website. Please help me here’s my code.

#include <SPI.h>
#include <Ethernet.h>
#include <DHT.h>
#define DHTPIN 7
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip = {192, 168, 0, 17 }; //Enter the IP of ethernet shield
byte serv = {192, 168, 0, 13} ; //Enter the IPv4 address

EthernetClient cliente;
void setup() {
Serial.begin(9600); //setting the baud rate at 9600
Ethernet.begin(mac, ip);
dht.begin();
}

void loop() {

float hum = dht.readHumidity(); //Reading the humidity and storing in hum
float temp = dht.readTemperature(); //Reading the temperature as Celsius and storing in temp
float fah = dht.readTemperature(true); //reading the temperature in Fahrenheit
float heat_index = dht.computeHeatIndex(fah, hum); //Reading the heat index in Fahrenheit
char tempCold = {“Cold”};
char tempHot = {“Hot”};
char statu = {“Hot”};
float heat_indexC = dht.convertFtoC(heat_index); //Converting the heat index in Celsius
if (cliente.connect(serv, 80))
{
Serial.println(“connected”);
cliente.print(“GET /arduino/data.php?”); //Connecting and Sending values to database
cliente.print(“temperature=”);
cliente.print(temp);
cliente.print("&humidity=");
cliente.print(hum);
// cliente.print("&statu=");
// cliente.print(tempCold);
// cliente.print("&statu=");
// cliente.print(tempHot);
Serial.print("Temperature= ");
Serial.println(temp);
Serial.print("Humidity= ");
Serial.println(hum);

}
if (temp>=28)//if temperature above of 25 degrees
{
cliente.print(“GET /arduino/data.php?”);
cliente.print(“statu=”);
cliente.println(tempHot);
Serial.print("Status : ");
Serial.println(tempHot);

}
else if(temp<=28)//if temperature is under 23 degrees
{
cliente.print(“GET /arduino/data.php?”);
cliente.print(“statu=”);
cliente.println(tempCold);
Serial.print("Status : ");
Serial.println(tempCold);
}

else {
// if you didn’t get a connection to the server:
Serial.println(“connection failed”);
}

delay(5000);
}

Please help me

With what? The code you improperly posted does something. You expect it to do something. You failed to describe either thing. Three strikes. You're out. Go sit on the bench.

I'm very sorry I'm new to this forum. This code will detect temperature and send it to a database and will show it to a page. It gets all the data including the Temperature and the Humidity but the Status of the temperature can't seem to display it. Please help me

       cliente.print("GET /arduino/data.php?"); //Connecting and Sending values to database
       cliente.print("temperature=");
       cliente.print(temp);
       cliente.print("&humidity=");
       cliente.print(hum);
      cliente.print("GET /arduino/data.php?");
      cliente.print("statu=");
      cliente.println(tempHot);

What does this mysterious PHP script look like? Does it REALLY deal with temperature and humidity OR statu?

I'll ask again (and only once more). What does the code ACTUALLY do? How does that differ from what you expect it to do?

Here’s what the data.php looks like. My only problem is with the statu and the rest are working but the statu wont send the value to the database.

<?php include ('connection.php'); $sql_insert = "INSERT INTO data (temperature, humidity, statu) VALUES ('".$_GET["temperature"]."', '".$_GET["humidity"]."', '".$_GET["statu"]."')"; if(mysqli_query($con,$sql_insert)) { echo "Done"; mysqli_close($con); } else { echo "error is ".mysqli_error($con ); } ?>

but the statu wont send the value to the database.

Your PHP code expects all three values (temperature, humidity, and statu) to have values when it is executed. You don't make any GET requests that contain all three values.

OMG IT WORKED. THANK YOU VERY MUCH!!!!!!