insert ultrasonic sensor values in mySQL with php and wifly

i want to input values in db mySQL with php. first, db is work well so i make php code below.

<?php

echo "insert_data_is_here\n";

error_reporting(E_ALL);

$con=mysqli_connect("ip","root", "pwd", "table");

if(mysqli_connect_errno($con)) 
{
	echo "Failed to connet to mySQL: " . mysqli_connect_error();
}

$distant = $_GET["distant"];

$sql = "insert in to db.data(distant) values(&distant)";
mysqli_query($con, $sql);

mysqli_close($con);

?>

i have wifi module RN-171 for network and i find out it have compatible wifly library but it quite hard to find out proper example. however, i try to making arduino code is below.

#include <Arduino.h>
#include <OneWire.h>
#include <SoftwareSerial.h>
#include "WiFly.h"

#define SSID      "name"
#define KEY       "pwd"
#define AUTH      WIFLY_AUTH_WPA2_PSK


SoftwareSerial uart(2, 3);
WiFly wifly(&uart);
Client client("localhost",80);


int echoPin = 7;
int triggerPin = 8;

// for ultrasonic
void setup() {
  /* init */
  Serial.begin(9600);
  uart.begin(9600);     // WiFly UART Baud Rate: 9600
  
  // wait for initilization of wifly
  delay(3000);
  //////////
  

  wifly.reset();
  
  Serial.println("Join " SSID );
  if(!wifly.isAssociated(SSID)) {
    if (wifly.join(SSID, KEY, AUTH)) {
      Serial.println("OK");
    } else {
      Serial.println("Failed");
    }
    wifly.save();
  }
  /////////
 
  /* ultranosic */
  pinMode(triggerPin, OUTPUT);    
  pinMode(echoPin, INPUT);   
  /////////
}

void loop() {
  
  long duration, distance;    


  digitalWrite(triggerPin, LOW);       
  delayMicroseconds(2);            
  digitalWrite(triggerPin, HIGH);  
  delayMicroseconds(10);           
  digitalWrite(triggerPin, LOW);        

  duration = pulseIn(echoPin, HIGH);        
  

  distance = duration / 29 / 2;        

  String str_distance = String(distance);
  Serial.print(str_distance + "cm");
  Serial.println();
  //////////


  
  wifly.print("GET /insert_data.php?distant=" + str_distance + "\r\n");
  /*
  wifly.print("distant=");
  wifly.print(str_distance);
  */
  
  if(wifly.available()) {  
   // Serial.write(wifly.read());
  }
  else {
    //Serial.println("UNAVAILABLE");
  }
  
  delay(500);
  
}

Do you have a question?

Client client("localhost",80);

The first thing you need to understand is what the name "localhost" means.

  wifly.print("GET /insert_data.php?distant=" + str_distance + "\r\n");

Exactly where do you think the insert_data.php script is supposed to be executed? Is is REALLY possible to execute the script on that server? I DO NOT THINK SO!