Can't sending data to phpmyadmin using ethernet shield + XAMPP

Hi! I've tried the way it is in this forum but it doesn't work. the data I send via Arduino is not on the record in my database, but I can manually enter data into the database. Please help. Sorry for my english

Here is my code :
Arduino Code

#include <SPI.h>
#include <Ethernet.h>
#define PORT 5000
#include "HX711.h"
#define DOUT A0
#define CLK A1
HX711 scale(DOUT, CLK);

byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
//IPAddress ip(192, 168, 1, 177);
byte ip[] = {192, 168, 1, 177 };
byte serv[] = {192, 168, 1, 2};
EthernetClient client;

float calibration_factor = 19.10;
int GRAM;
EthernetServer server(80);
void setup()
{
Serial.begin(9600);
Ethernet.begin(mac, ip);

scale.set_scale();
scale.tare();
}

void loop()
{

// Serial.println("connected");
scale.set_scale(calibration_factor);
GRAM = scale.get_units(), 4;

Serial.println(GRAM);
if (client.connect(serv, 80)) {
Serial.println("Connected");
client.println("GET C:/xampp/htdocs/PA/data.php? HTTP/1.1");
client.println("sensor=");
client.print(GRAM);
// client.println(" HTTP/1.0");
client.print("Host: 192.168.1.2");
client.println("Connection: close");
// client.println();
Serial.print("sensor=");
Serial.print(GRAM);
// client.stop();
}
else {

Serial.println("connection failed");
}
delay(2000);
}

PHP Code :

connection.php

<?php $username = "root"; $pass = ""; $host = "localhost"; $db_name = "project"; $con = mysqli_connect ($host, $username, $pass, $db_name); $db = mysqli_select_db ( $con, $db_name ); if (!$con) { die("Connection failed: " . mysqli_connect_error()); } ?>

data.php

<?php include ('connection.php'); if (isset($_GET['sensor'])){ $sensor=$_GET["sensor"]; } else{ echo "Data not received"; } $sql_insert = "INSERT INTO data (`sensor`) VALUES ('".$_GET['sensor']."')"; if(mysqli_query($con,$sql_insert)) { echo "Ok!"; mysqli_close($con); } else { echo "error is ".mysqli_error($con); } ?>

display.php

<?php $url=$_SERVER['REQUEST_URI']; header("Refresh: 5; URL=$url"); // Refresh the webpage every 5 seconds ?> Arduino Ethernet Database .table_titles { padding-right: 20px; padding-left: 20px; color: #000; } .table_titles { color: #FFF; background-color: #0000FF; } table { border: 2px solid #333; } body { font-family: "Trebuchet MS", Courier; }

Arduino Data Logging to Database

<?php include('connection.php'); $result = mysqli_query($con,'SELECT * FROM data ORDER BY id ASC'); // Process every record $oddrow = true; while($row = mysqli_fetch_array($result)) { if ($oddrow) { $css_class=' class="table_cells_odd"'; } else { $css_class=' class="table_cells_even"'; } $oddrow = !$oddrow; echo ""; echo ""; echo ""; }

// Close the connection
mysqli_close($con);
?>

Sensor
" . $row['sensor'] . "

Thanks before :slight_smile: