I am trying to add some Values to a Database with PHP I send some parametres from a Android Application they also arrive in the right way. I checked it with echo and printed all the Parameteres I send.
id (PRIMARY_KEY, AUTO_INCREMENT)
deviceID (TEXT)
name (TEXT)
latitude (TEXT)
longitude (TEXT)
Thats the Structure and the name of the Database is position
This is my query but it just doesent work.
$deviceID = $_POST['deviceID'];
$name = $_POST['name'];
$latitude = $_POST['latitude'];
$longitude = $_POST['longitude'];
$result = mysql_query("INSERT INTO position(deviceID, name, latitude, longitude) VALUES('$deviceID', '$name', '$latitude', '$longitude')");
http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_position
Positionis a function name in MySQL: you should escape it using backticks (`), and you need to add a space betweenpositionand the parentheses.