wifi shield and PHP-mysql

hi to all, i write this easy php file

<?php
if(isset($_GET['id']) and ($_GET['temp']) and ($_GET['hum']) )
{

$id = $_GET['id'];
$temp = $_GET['temp'];
$hum = $_GET['hum'];
$con=mysql_connect("10.10.10.3","myid","mypw");
if (!$con)
{
    die('Could not connect: '.mysql_error());
}
mysql_select_db("wifitest",$con);
// Check connection
$sql=mysql_query("INSERT INTO  sensori (`prog` ,`id`,`temp`,`hum`,`timestamp`)VALUES (NULL , '" . $id . "',, '" . $temp . "',, '" . $hum . "', CURRENT_TIMESTAMP);");
echo "1 record added";
mysql_close();
}
else
{
echo "error";
}
?>

now i use a shield wifi, and i use arduino sdk 1.0.2 because the wifi shild have a problem whit 1.0.5 arduino sdk
now i write this skretch

String temp ="";  // temp
String hum ="";  //  hum

WiFiClient client;

void setup() {
  Serial.begin(9600);

  Serial.println("Attempting to connect to WPA network...");
  status = WiFi.begin(ssid, pass);


  if ( status != WL_CONNECTED) {
    Serial.println("can't to connect to wifi");
    while(true);
  }
  else {
    Serial.println("Connected to network");
  }

}

void loop() {
  // test 
   id="3";
   temp="30";
   hum="50";
   
  //check
if ( status != WL_CONNECTED) {
    Serial.println("NON E' POSSIBILE CONNETTERSI AL WIFI");
  //  while(true);
  }
  else {
   
    if (client.connect(server,80)) // CONNECT TO SERVER to port 80
  {
 
   strURL = "POST /wifi_connect/insert.php?id="+id+"&temp="+temp+"&hum="+hum+" HTTP/1.1";
   Serial.println("writed 1 record");
 client.stop();
   }
  else {
 Serial.println("ERROR SERVER ");
  }
}
delay(10000);
 }

i don’t know because don’t work can you help me?
best regards
j.

i don't know because don't work can you help me?

What part doesn't work?

If you want it to work, you should upgrade to IDE v1.0.5. Prior versions have problems with connections. However, to use v1.0.5, you must upgrade the wifi shield firmware.

   id="3";

id is not defined in your code.

if ( status != WL_CONNECTED) {
    Serial.println("NON E' POSSIBILE CONNETTERSI AL WIFI");
  //  while(true);
  }
  else {

This is useless in loop(), since loop() will never be called if the status is NOT WL_CONNECTED.

   strURL = "POST /wifi_connect/insert.php?id="+id+"&temp="+temp+"&hum="+hum+" HTTP/1.1";

strURL is not defined in your code.

hi to all and thanks for your answer, but if i use IDE v1.0.5 i have this message "ERROR SERVER " because the ide 1.0.5 have a bug whit wifi shild, do you have other idea?
i rewrite the code

#include <WiFi.h>
#include <SPI.h>
char ssid[] = "my_wifi";     //  IL NOME DEL SSID 
char pass[] = "my_pw";    //  password Rete
int status = WL_IDLE_STATUS;     // stato connessione 
IPAddress server(192,10,3,25); // server cicala
String strURL = ""; // url del file php èper inserire i dati 
String id ="";  //  id
String temp ="";  //  temp
String hum ="";  //  hum
WiFiClient client;
void setup() {
  Serial.begin(9600);
  Serial.println("Attempting to connect to WPA network...");
  status = WiFi.begin(ssid, pass);
  if ( status != WL_CONNECTED) {
    Serial.println("non è possibile connettersi al wifi");
    while(true);
  }
  else {
    Serial.println("Connected to network");
  }

}

void loop() {

   id="3";
   temp="30";
   hum="50";
   
    if (client.connect(server,80)) // CONNESSION SERVER CICALA
  {
        Serial.println("Connesso");
   strURL = "POST /wifi_connect/insert.php?id="+id+"&temp="+temp+"&hum="+hum+" HTTP/1.1";
  // Serial.println("ho scritto 1 record");
  Serial.println(strURL);
  
  client.stop();
   }// se sei connesso al server cicala
  else {
 Serial.println("IL SERVER NON è RAGGIUNGIBILE ");
  }//

  //esegui la richiesta ogni 10 secondi
  delay(10000);
  
}

but don’t work :frowning:

but don’t work

But do something. What does it do? What serial output do you see?

I fix it, the problem is that the ide 1.0.5 have a bug, all work if i use 1.0.2 ide version
it's a very bad situation :frowning: :frowning: