I am developing Android application and I am trying to insert some data to mysql database, one of the columns is storing the name of the gps location,I read values like this ("Alfa Gas Station"), but when I read unknown place the value become like this (29°17'37.3"N 47°52'23.4"E) and when I try to save it, the php code returns Not registered as shown in my code and I want to save it in my database in this form. when I tried the solution of in this link to prevent SQL-Injection How can I prevent SQL-injection in PHP? , It prevent the insertion process but this is not what do I want, I want the code insert the string value whatever it was consisting of, because this value is generated from google map not written by users so it can't be harmful, so I wish anyone can help me:
<?php
if($_SERVER["REQUEST_METHOD"]=="POST")
{
require "init.php";
creat_Student();
}
function creat_Student()
{
global $con;
$id=$_POST["id"];
$lat=$_POST["lat"];
$long=$_POST["long"];
$price=$_POST["price"];
$name=$_POST["name"];
$address=$_POST["address"];
$status=$_POST["status"];
$query="INSERT INTO parking (`userid`, `lat`, `long`, `price`, `name`, `address`, `status`) VALUES ('$id','$lat','$long','$price', '$name','$address','$status');";
if(mysqli_query($con,$query)){
echo "Successfully Registered";
}
else
{
echo "Not registered";
}
mysqli_close($con);
}
It works well but it didn't work when it is unknown place , and the name column in my database is 400 Varchar