How setting in phpmyadmin database five digit behind comma

I use module GPS sensor and arduino to get coordinate lat long. In arduino IDE value show five digit behind comma. But in database it just two digit behind comma. How can i solve my problem?

Please show your code.
Please show the configuration of the database table. It's long ago that I used MySQL, I think that the command is describe table yourTable.

this is my php code to insert data :

<?php
  $latitude = (float) $_GET['latitude'];
  $longitude = (float) $_GET['longitude'];
  
$servername = "localhost";
$username = "root";
$password = "";
$database = "";

try {
    $connect = new PDO("mysql:host=$servername;dbname=$database", $username, $password);
    // set the PDO error mode to exception
    $connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $result = "INSERT INTO lokasi (latitude, longitude)
    VALUES ('".$latitude."', '".$longitude."')";
    // use exec() because no results are returned
    $connect->exec($result);
    echo "New record created successfully";
    }
catch(PDOException $e)
    {
    echo $result . " " . $e->getMessage();
    }

$connect = null;

?>

this is structure my database

The problem is likely not in the PHP, it's more likely in the way you send it to the server that truncates it.

So I suggest that you post your Arduino sketch.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.