please help me master
i have got a problem in transferring data from arduino to Mysql database (i am using php)
i use ethernet shield to transfer data from client to server
i'm using Xampp, i have local network ... no internet connection.
Here is my project :
my php code:
- connect1.php
<?php
//include("add.php");
function Conection() {
if (!($link=mysql_connect("localhost","root",""))) {
exit();}
if (!mysql_select_db("belajar",$link)) {
exit();}
echo "koneksi berhasil";
}
// mysql_query("INSERT INTO arus(waktu,arus1,arus2,arus3) VALUES ('$time','$_GET[Irms1]','$_GET[Irms2]','$_GET[Irms3]')");
?>
- add.php
<?php
 include("conec1.php");
$link=Conection();
if(isset ($_GET['Irms1'], $_GET['Irms2'], $_GET['Irms3']));
$times = round((microtime(true)-$_SERVER['REQUEST_TIME_FLOAT']),4);
Â
 mysql_query("INSERT INTO arus(arus1,arus2,arus3) VALUES ('$_GET[Irms1]','$_GET[Irms2]','$_GET[Irms3]')");
Â
?>
i have some errors: my arduino can send some data but the data in mysql database will update if i plug out then plug in again the utp cable
#include <SPI.h>
#include <Ethernet.h>
#include <HTTPClient.h>
#include "EmonLib.h"
// this must be unique
byte mac[] = {Â 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
// change to your network settings
IPAddress ip(192,168,1,9);
IPAddress gateway(192, 168, 3, 1);
IPAddress subnet(255, 255, 255, 0);
// change to your server
IPAddress server(192,168,1,100); // Google 31.170.162.23
//Change to your domain name for virtual servers
char serverName[] = "192.168.1.100";
// If no domain name, use the ip address above
// char serverName[] = "74.125.227.16";
// change to your server's port
int serverPort = 80;
EthernetClient client;
//int totalCount =0;
 EnergyMonitor emon1;
 EnergyMonitor emon2;
 EnergyMonitor emon3;
char pageAdd[64];
// set this to the number of milliseconds delay
// this is 30 seconds
#define delayMillis 30000UL
unsigned long thisMillis = 0;
unsigned long lastMillis = 0;
void setup() {
 Serial.begin(9600);
 // disable SD SPI
//Â pinMode(4,OUTPUT);
// digitalWrite(4,HIGH);
 // Start ethernet
 Serial.println(F("start broo"));
 Ethernet.begin(mac, ip, gateway, gateway, subnet);
 // If using dhcp, comment out the line above
 // and uncomment the next 2 lines
 // if(!Ethernet.begin(mac)) Serial.println(F("failed"));
 // else Serial.println(F("ok"));
 digitalWrite(10,HIGH);
 Serial.println(Ethernet.localIP());
 delay(2000);
 Serial.println(F("Siap Boss"));
}
void loop()
{
 thisMillis = millis();
 if(thisMillis - lastMillis > delayMillis)
 {
  lastMillis = thisMillis;
  // Modify next line to load different page
  // or pass values to server
  //sprintf(pageAdd,"/",totalCount);
    emon1.current(1, 29);
    emon2.current(2, 29);
    emon3.current(3, 29);
  Â
   double Irms1 = emon1.calcIrms(1480);
   double Irms2 = emon2.calcIrms(1480);
   double Irms3 = emon3.calcIrms(1480);
  Â
   char Irms1Buffer[8];
   char Irms2Buffer[8];
   char Irms3Buffer[8];
  Â
  Â
   dtostrf(Irms1,3,1,Irms1Buffer);
   dtostrf(Irms2,3,1,Irms2Buffer);
   dtostrf(Irms3,3,1,Irms3Buffer); Â
 Â
  sprintf(pageAdd,"/add.php?Irms1=%s&&Irms2=%s?&&Irms3=%s",Irms1Buffer,Irms2Buffer,Irms3Buffer);
  if(!getPage(server,serverPort,pageAdd)) Serial.print(F("Fail "));
  else Serial.print(F("Pass "));
  //totalCount++;
 Â
Â
 Serial.println(Irms1);
 Serial.println(Irms2);
 Serial.println(Irms3);
 delay(5000);    Â
 } Â
}
byte getPage(IPAddress ipBuf,int thisPort, char *page)
{
 int inChar;
 char outBuf[128];
 Serial.print(F("connecting..."));
 if(client.connect(ipBuf,thisPort))
 {
  Serial.println(F("connected"));
  sprintf(outBuf,"GET %s HTTP/1.1",page);
  client.println(outBuf);
  sprintf(outBuf,"Host: %s",serverName);
  client.println(outBuf);
  client.println(F("Connection: close\r\n"));
 }
 else
 {
  Serial.println(F("failed"));
  return 0;
 }
 // connectLoop controls the hardware fail timeout
 int connectLoop = 0;
 while(client.connected())
 {
  while(client.available())
  {
   inChar = client.read();
   Serial.write(inChar);
   // set connectLoop to zero if a packet arrives
   connectLoop = 0;
  }
  connectLoop++;
  // if more than 10000 milliseconds since the last packet
  if(connectLoop > 10000)
  {
   // then close the connection from this end.
   Serial.println();
   Serial.println(F("Timeout"));
   client.stop();
  }
  // this is a delay for the connectLoop timing
  delay(1);
 }
 Serial.println();
 Serial.println(F("disconnecting."));
 // close client end
 client.stop();
 return 1;
}
big appreciate for your help