Arduino + ESP8266 not posting data using PHP to XAMPP SQL

I would like to ask some help about my error. I am trying to push sensor data into the sql of XAMPP with the use of ESP8266 and some php coding. I would like to know why my output is not pushing into the database. This database will be offline and only be on localhost so I will not worry about attacks because it is just in the local server.

This is my Arduino Code

#include <SoftwareSerial.h>
//------------------WIFI VALUES------------------------
SoftwareSerial esp8266(2, 3); // 2 = RX, 3 = TX
String ssid ="ScoobyDooby Network";
String password ="rapperjj20";
String server =""; //ip address of localhost
String uri = "/~Thesis/InsertData.php";
String data;
//------------------WIFI VALUES END--------------------

//------------------PH VALUES START------------------
#define SensorPin A5            //pH meter Analog output to Arduino Analog Input 2
#define Offset -1.00            //deviation compensate
unsigned long int avgValue;  //Store the average value of the sensor feedback
float b;
int buf[10],temp; 
static float phValue;
//------------------PH VALUES END--------------------

void resetWifi() {

  if(esp8266.find("OK") ) 
    Serial.println("Module Reset");


void connectWifi() {
  String cmd = "AT+CWJAP=\"" +ssid+"\",\"" + password + "\"";

  else {
    Serial.println("Not connected!");

void setup() {

void httppost() {

  esp8266.println("AT+CIPSTART=\"TCP\",\"" + server + "\",80");//start a TCP connection.
  if( esp8266.find("OK")) {
    Serial.println("TCP connection ready");
  String postRequest =
  "POST " + uri + " HTTP/1.0\r\n" +
  "Host: " + server + "\r\n" +
  "Accept: *" + "/" + "*\r\n" +
  "Content-Length: " + data.length()+ "\r\n" +
  "Content-Type: application/x-www-form-urlencoded\r\n" +
  "\r\n" + data;
  String sendCmd = "AT+CIPSEND=";//determine the number of caracters to be sent.

  if(esp8266.find(">")) { 

    if(esp8266.find("OK")) { 
      Serial.println("Packet sent");
      while (esp8266.available()) {
        String tmpResp = esp8266.readString();
      // close the connection
void loop()
//------------------PH METER CODES START------------------

  for(int i=0;i<10;i++)       //Get 10 sample value from the sensor for smooth the value
  for(int i=0;i<9;i++)        //sort the analog from small to large
    for(int j=i+1;j<10;j++)
  for(int i=2;i<8;i++)                      //take the average value of 6 center sample
  phValue=(float)avgValue*5.0/1024/6; //convert the analog into millivolt
  phValue=3.5*phValue + Offset;                      //convert the millivolt into pH value
  Serial.print("    pH:");  
  Serial.println(" ");
//------------------PH METER CODES END--------------------

         //------------------Convert the bit data to string form--------------------
String phValue1 = String(phValue);

Serial.print("pH Level: ");

data = "x=" + phValue1; // data sent must be under this form //name1=value1&name2=value2.
Serial.print("DATA to be sent: ");

 //------------------Conversion ends----------------------------------------

This is my InsertData.php

 require_once 'conf.php';

 $read = array();

 //Data sent by arduino will be passed into this variable
 $Temp = $_POST["x"];

 $read = explode("-", $Temp);

 //Setting newt_textbox_set_height(textbox, height) default timezone
 $date = date("Y/m/d H:i:sa");

 //Inserting data to different table
 $phLevelSQL = 'INSERT INTO `phsensor` (`phLevel `,`dateRet`) VALUES ("'.$read[0].'", "'.$date.'")';

 //Inserting data to the database

 mysqli_query($connection, $phLevelSQL);



This is the conf.php

 $dbhost   ='localhost';
 $dbuser   ='arduino';
 $dbpass   ='thesis123';
 $dbname   ='arduino_thesis';
 $connection = mysqli_connect($dbhost,$dbuser,$dbpass,$dbname);

 if (mysqli_connect_errno()) {
 printf("Connect failed: %s\n", mysqli_connect_error());

This is my Database

Finally this is the output.

I am not getting any data inserted into the table.
Can I ask for advice, help, and tips?