Nodemcu &sound senor

I am trying to upload data from a sound senor to a localhost server using nodemcu.I am getting ''connection failed" in SM.can’t find out the problem in the code.
here is the code.

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>

const int MIC = 0; //the microphone amplifier output is connected to pin A0
int adc;
int dB;  //the variable that will hold the value read from the microphone each time
const char* ssid = "baggu";// 
const char* password = "nopasswordforu78";
//WiFiClient client;
char server[] = " ip address";   //eg: 192.168.0.222


WiFiClient client;    


void setup()
{
 Serial.begin(115200);
  pinMode(A0, INPUT);
  // Connect to WiFi network
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
 
  WiFi.begin(ssid, password);
 
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
 
  // Start the server
  //server.begin();
  Serial.println("Server started");
  Serial.print(WiFi.localIP());
  delay(1000);
  Serial.println("connecting...");
 }
void loop(){
  
  adc = analogRead(MIC); //Read the ADC value from MIC
  dB = (adc + 83.2073) / 11.003; //Convert ADC value to dB using Regression values
  //Serial.print("Sound Level--");
  //Serial.print(dB);
  //Serial.print(",");
  //Serial.println(" dB");
  //delay(100);
  Sending_To_phpmyadmindatabase(); 
  delay(30000); // interval
}

 void Sending_To_phpmyadmindatabase()   //CONNECTING WITH MYSQL
 {
   if (client.connect(server, 80)) {
    Serial.println("connected");
    // Make a HTTP request:
    Serial.print("GET /testcode/lm.php?sound=");
    client.print("GET /testcode/lm.php?sound=");     //YOUR URL
    Serial.println(dB);
    client.print(dB);
    client.print(" ");      //SPACE BEFORE HTTP/1.1
    client.print("HTTP/1.1");
    client.println();
    client.println("Host:local ip address");
    client.println("Connection: close");
    client.println();
  } else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
 }