Send data to MySQL (Arduino Uno, Eth shield W5100, IR obstacle sensor) [solved]

This is the code that I have change according to your reply:

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

byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };
byte ip[] = { 192, 168, 0, 127 };
byte server[] = { 192, 168, 0, 121 };

//Initialize the Ethernet server library
EthernetClient client;

int LED = 13; // Use the onboard Uno LED
int isSensePin = 7;  // This is our input pin
int isSensePin2 = 8;
int isSensePin3 = 9;
int sensor1 = HIGH;  // HIGH MEANS NO OBSTACLE
int sensor2 = HIGH;
int sensor3 = HIGH;

void setup()
{
  pinMode(LED, OUTPUT);
  pinMode(isSensePin, INPUT);
  pinMode(isSensePin2, INPUT);
  pinMode(isSensePin3, INPUT);

  Serial.begin(9600);
  
  // =====================
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // try to congifure using IP address instead of DHCP:
    Ethernet.begin(mac, ip);
  }
  // =====================
}

void loop()
{
  sensor1 = digitalRead(isSensePin);
  sensor2 = digitalRead(isSensePin2);
  sensor3 = digitalRead(isSensePin3);

  if (client.connect(server, 80))
  {
    Serial.println("---connection ok---");

    client.print("GET /arduino/getdata.php?");
    client.print("sensor1=");
    client.print(sensor1);
    client.print("&sensor2=");
    client.print(sensor2);
    client.print("&sensor3=");
    client.print(sensor3);

    client.print(" HTTP/1.1");
    client.println("Host: 192.168.0.121");
    client.println("Connection: close");
    client.println();

    Serial.print("sensor1=");
    Serial.println(sensor1);
    Serial.print("sensor2=");
    Serial.println(sensor2);
    Serial.print("sensor3=");
    Serial.println(sensor3);

     // ============

    // if there are incoming bytes available
    // from the server, read them and print them:
    while (client.available()) {
      char c = client.read();
      Serial.print(c);
    }

    // if the server's disconnected, stop the client:
    if (!client.connected()) {
      Serial.println();
      Serial.println("disconnecting.");
      client.stop();
    }
    // ============
  }

  else
  {
    Serial.println("---connection failed---\n");
    client.stop();
  }

  delay (500);

  
  if (sensor1 == LOW)
  {
    Serial.println("Occupied1");
    digitalWrite(LED, HIGH);
  }
  else
  {
    Serial.println("Available1");
    digitalWrite(LED, LOW);
  }
  delay(1000);

 
  if (sensor2 == LOW)
  {
    Serial.println("Occupied2");
    digitalWrite(LED, HIGH);
  }
  else
  {
    Serial.println("Available2");
    digitalWrite(LED, LOW);
  }
  delay(1000);

  
  if (sensor3 == LOW)
  {
    Serial.println("Occupied3");
    digitalWrite(LED, HIGH);
  }
  else
  {
    Serial.println("Available3");
    digitalWrite(LED, LOW);
  }
  delay(1000);
}

The result shows that one time the connection is ok and another time it is failed:

---connection ok---
sensor1=1
sensor2=1
sensor3=1
Available1
Available2
Available3
---connection failed---

Occupied1
Available2
Occupied3
---connection ok---
sensor1=0
sensor2=1
sensor3=0
Occupied1
Available2
Occupied3
---connection failed---

Available1
Occupied2
Occupied3
. . .

There is this one part, it print this in the serial monitor:

---connection ok---
sensor1=1
sensor2=1
sensor3=1
HTTP/1.1 400 Bad Request
Date: Fri, 04 May 2018 15:42:23 GMT
Server: Apache/2.4.33 (Win64) PHP/5.6.35
Content-Length: 311
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.

</p>
<hr>
<address>Apache/2.4.33 (Win64) PHP/5.6.35 Server at localhost Port 80</address>
</body></html>

disconnecting.
Available1
Available2
Available3
---connection ok---
sensor1=1
sensor2=1
sensor3=1
HTTP/1.1 400 Bad Request
Date: Fri, 04 May 2018 15:42:27 GMT
Server: Apache/2.4.33 (Win64) PHP/5.6.35
Content-Length: 311
Connection: close
Content-Type: text/html; charset=iso-8859-1
. . .

6v6gt:
Is the web browser that you manually entered the following command on
http://192.168.0.121/arduino/getdata.php?sensor1=91&sensor2=92&sensor3=93
running on an normal PC in your network or is it running on the web server itself ?

It's running on WAMP server.

6v6gt:
Can you access the web server log files ?

Yes, I can access the log files.