arduino as webserver and webclient (problems : database not update)

hye everyone, sorry if the title a bit confusing…now im working on ultrasonic sensor with arduino ethernet. i want to view the data on any webpage (192.168.0.110), and at the same time data from arduino will be save into my database at phpmyadmin…so i make the arduino as webserver and webclient and little modified on the timer so my arduino will not ignore my request to view the webpage…so here a coding…

#include <SPI.h>
#include <Ethernet.h>
#include <SimpleTimer.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //assign arduino mac address
byte ip[] = {192, 168, 0, 110 }; // ip in lan assigned to arduino
byte gateway[] = {192, 168, 0, 1 }; // internet access via router
byte subnet[] = {255, 255, 255, 0 }; //subnet mask
EthernetServer server(80); //server port arduino server will use
EthernetClient client;
byte serverName[] = { 192, 168, 0, 105 }; // (IP) zoomkat web page server IP address
float v, met, cm;
SimpleTimer timer;
void setup(){
  
  pinMode (2,OUTPUT);//attach pin 2 to vcc
  pinMode (5,OUTPUT);//attach pin 5 to GND
  pinMode (4, OUTPUT);
  digitalWrite(4, OUTPUT);
  
  Ethernet.begin(mac,ip,gateway,gateway,subnet); 
  server.begin();
  Serial.begin(9600); 
  timer.setInterval(30000, readSensor);
  timer.setInterval(60000,sendData);
  
}
void loop(){
timer.run();
      // listen for incoming clients
  EthernetClient client = server.available();
  if (client) {
 //   Serial.println("new client");
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
 //       Serial.write(c);
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connection: close");  // the connection will be closed after completion of the response
          client.println("Refresh: 60");  // refresh the page automatically every 60 sec
          client.println();
          client.println("<!DOCTYPE HTML>");
          client.println("<html>");
          client.print("<p style='text-align: center;'>&nbsp;</p>");
          client.print("<p style='text-align: center;'><span style='font-size: x-large;'><strong>Tank A</strong></span></p>");
          client.print("<p style='text-align: center;'><span style='color: #0000ff;'><strong style='font-size: large;'>Centimeter = ");
          client.println(cm);
          client.print("</strong></span><h style='text-align: center;'><span style='color: #0000ff;'><strong style='font-size: large;'></sup>cm</strong></span></h></p>");
          client.print("<p style='text-align: center;'><span style='color: #0000ff;'><strong style='font-size: large;'>meter = ");
          client.println(met);
          client.print("</strong></span><h style='text-align: center;'><span style='color: #0000ff;'><strong style='font-size: large;'></sup>m</strong></span></h></p>");
          client.print("<p style='text-align: center;'><span style='color: #0000ff;'><strong style='font-size: large;'>Volume = ");
          client.println(v);
          client.print("</strong></span><h style='text-align: center;'><span style='color: #0000ff;'><strong style='font-size: large;'></sup>meter cubic</strong></span></h></p>");
          client.print("<p style='text-align: center;'>&nbsp;</p>");
          client.print("<p style='text-align: center;'>&nbsp;</p>");
          client.print("<p style='text-align: center;'>&nbsp;");
          
          // Date and Time script
          client.print("<script language='javascript'>");
          client.println();
          client.print("<!--");
          client.println();
          client.print("var today = new Date()");
          client.println();
          client.print("document.write(today); //--> </script>");
          client.print("</p>");
    
          client.println("</html>");
          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        }
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
   // Serial.println("client disconnected");
  }
  

} 
//////////////////////////
void readSensor()
{
  float j = 1.102;  //volume constant
  
 digitalWrite(2, HIGH);
  // establish variables for duration of the ping,
  // and the distance result in inches and centimeters:
  long  duration;
  long getDecimal (float m);
  
  // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
  // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
  pinMode(8, OUTPUT);// attach pin 3 to Trig
  digitalWrite(8, LOW);
  delayMicroseconds(2);
  digitalWrite(8, HIGH);
  delayMicroseconds(5);
  digitalWrite(8, LOW);
  // The same pin is used to read the signal from the PING))): a HIGH
  // pulse whose duration is the time (in microseconds) from the sending
  // of the ping to the reception of its echo off of an object.
  pinMode (7, INPUT);//attach pin 4 to Echo
  duration = pulseIn(7, HIGH);
  // convert the time into a distance
  cm = microsecondsToCentimeters(duration);
  
  met = cm * 0.01;//change cm to m(1m = 100cm)
  v = (3.142*j*j*met);//calculate volume
 
  Serial.print(cm);
  Serial.print(" cm ");
  Serial.print(met);
  Serial.print(" m");
  Serial.println();
  Serial.print (v);
  Serial.print("  Volume(m^3)");
  Serial.println();
  

}
void sendData() 
{
  if (client.connect(serverName, 80)) {
    Serial.println("connected");
   
    client.print("GET /ultrasonic/add.php?centimeter=");
    client.print(cm);
    client.print("&meter=");
    client.print(met);
    client.print("&volume=");
    client.print(v);
    client.println(" HTTP/1.1");                 
    client.println("Host: 192.168.0.105");          
    client.println("Accept: text/html");       
    client.println("Connection: close");       
    client.println();                           
    client.println();
    
  } 
  else {
    Serial.println("connection failed");
    Serial.println();
  }
  Serial.println();
  Serial.println("disconnecting.");
  client.stop();
}
long microsecondsToCentimeters(long microseconds)
{
  // The speed of sound is 340 m/s or 29 microseconds per centimeter.
  // The ping travels out and back, so to find the distance of the
  // object we take half of the distance travelled.
  return microseconds / 29 / 2;
}

ok for the result, i have managed successfully to view the webpage and every 60 sec it will refresh automatically…but, it dont update the data at my database…i have try manually for webclient to check my php scripts…its all worked and tabulated on their own rows…and for other confirmation, i use this code and removed webserver code at my loop just to test auto updating into database…and its working…but, when i put webserver code back into my loop it didnt work as well what i want…can you help me?

You should read the response from the server. You are sending a request and immediately closing the connection, but not getting the reply. Try this.

void sendData() 
{
  if (client.connect(serverName, 80)) {
    Serial.println("connected");

// send the request   
    client.print("GET /ultrasonic/add.php?centimeter=");
    client.print(cm);
    client.print("&meter=");
    client.print(met);
    client.print("&volume=");
    client.print(v);
    client.println(" HTTP/1.1");                 
    client.println("Host: 192.168.0.105");          
    client.println("Accept: text/html");       
    client.println("Connection: close");       
    client.println();                           
 
// read and display the response
    while(client.connected()) {
      while(client.available()) {
        Serial.write(client.read());
      }
    }

// now close the connection
    Serial.println("\r\ndisconnecting.");
    client.stop();
  } 
  else {
    Serial.println("connection failed");
    Serial.println();
  }
}