I am trying to post information to a table and depending on if the data is from the emulator or from my phone, I want to post it in two different places. If I post from my phone, it goes into the right table but if I post from my emulator it also goes into the table that is for my phone. So, this leads me to finding that for some reason this is true for my emulator for some reason:
$_POST['location']!="-1.0 -1.0"
I copied and pasted the value “-1.0 -1.0” from the table into the logical expression. For some reason $_POST[‘location’] is not the right value. Syntax? Here is more of my php code below:
if($_POST['location']!="-1.0 -1.0" && $_POST['location']!=""){
$sql1 = "INSERT INTO names_gps (Name,Location) VALUES ('$_POST[name]','$_POST[location]')";
//however, in the table names_gps I get "-1.0 -1.0"
if (!mysql_query($sql1,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
} else {
$sql2 = "INSERT INTO names (Name,Location) VALUES ('$_POST[name]','$_POST[location]')";
if (!mysql_query($sql2,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
}
Can someone see where I made an error here?
I just changed the Android code so that if it couldn’t get the gps location it returned an empty string. Then modified the php to:
Well it works for what I am looking for, any better way to do this?