arduino connected with local server(xampp) but data is not saving in database.

Hello! here is my code.plz have a look. I have been trying since last 2 weeks .after watching several posts, youtube, google help now I connected my arduino+ethernet shield with my localhost xampp server, it is showing that it’s connected but still data is not saving in my MySQL.i seek your help please, really getting upset…

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

byte mac[] = { 0x90, 0xA2, 0xDA, 0x0F, 0xFA, 0x57 };

char server[] = "";
IPAddress ip(192, 168, 0, 105);
IPAddress myDns(192, 168, 0, 1);

EthernetClient client;
float temp;

unsigned long beginMicros, endMicros;
unsigned long byteCount = 0;
bool printWebData = true;  // set to false for better speed measurement

void setup() {
  while (!Serial) {

  Serial.println("Initialize Ethernet with DHCP:");
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // Check for Ethernet hardware present
    if (Ethernet.hardwareStatus() == EthernetNoHardware) {
      Serial.println("Ethernet shield was not found.  Sorry, can't run without hardware. :(");
      while (true) {
        delay(1); // do nothing, no point running without Ethernet hardware
    if (Ethernet.linkStatus() == LinkOFF) {
      Serial.println("Ethernet cable is not connected.");
    // try to congifure using IP address instead of DHCP:
    Ethernet.begin(mac, ip, myDns);
  } else {
    Serial.print("  DHCP assigned IP ");
  // give the Ethernet shield a second to initialize:
    Serial.print("connecting to ");

  // if you get a connection, report back via serial:
  if (client.connect(server, 80)) {
    Serial.print("connected to ");
    // Make a HTTP request:
              //measuring temp:
          temp = analogRead(A0);
          temp= temp * 0.48828125;
          client.print( "GET /add.php?");
          //client.print( "POST /add.php?");
          client.print( temp );

          client.println(" HTTP/1.1");
          client.println( "Host:" );
          client.println("Content-Type: text/html");
          client.println("Connection: close");  // the connection will be closed after completion of the response
          client.println("Refresh: 5");  // refresh the page automatically every 5 sec

  } else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  beginMicros = micros();

void loop() {
  // if there are incoming bytes available
  // from the server, read them and print them:
  int len = client.available();
  if (len > 0) {
    byte buffer[80];
    if (len > 80) len = 80;, len);
    if (printWebData) {
      Serial.write(buffer, len); // show in the serial monitor (slows some boards)
    byteCount = byteCount + len;

  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    endMicros = micros();
    Serial.print("Received ");
    Serial.print(" bytes in ");
    float seconds = (float)(endMicros - beginMicros) / 1000000.0;
    Serial.print(seconds, 4);
    float rate = (float)byteCount / seconds / 1000.0;
    Serial.print(", rate = ");
    Serial.print(" kbytes/second");

    // do nothing forevermore:
    while (true) {

here is my PHP file, if I manually run this file in the browser than its saving the data, but I can’t save the data through Arduino using the same code. Even i used 1php file to save the data as someone suggested in other posts but still not working

   //$date1=$date('Y-m-d H:i:s');
   //$Sql="insert into temperature (datetime,temperature)  values('2018-09-17 08:45:19', '33.46 C')";   
   //$Sql="insert into temperature (datetime,temperature)  values('$date1' , '$temp1' )"; 
   $Sql="insert into temperature (datetime,temperature)  values ('$date1' , '".$_GET["temp"]."')";   
   header("Location: insertareg.php");


function Conection(){
   if (!($link=mysqli_connect("localhost", "root", "","arduino")))  {
   if (!mysqli_select_db($link,"arduino")){
   return $link;


   <title>Data of Sensor</title>
<h1>Data from the temperature sensors</h1>
<form action="add.php" method="get">
   <td>Temperature 1</td>
   <td><input type="text" name="temp1" size="20" maxlength="30"></td>
<input type="submit" name="accion" value="Grabar">
   $result=mysqli_query($link,"select * from temperature");
<table border="1" cellspacing="1" cellpadding="1">
         <td>&nbsp;DATETIME &nbsp;</td>
		 <td>&nbsp;Temperature &nbsp;</td>
   while($row = mysqli_fetch_array($result)) {
printf("<tr><td> &nbsp;%s </td><td> &nbsp;%s&nbsp; </td></tr>", $row["datetime"], $row["temperature"]);

One thing that jumps out at me is the use of the refresh. Automatic refreshing of pages depends on the client side (the web browser, normally). The Arduino is not a web browser; it doesn't do all that stuff automatically for you. If you want it to refresh a page, you need to tell it to do that.

Thanks for your response dear, I omitted that line but still, it is not working.any idea?seek help...