Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6954567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:37:21+00:00 2026-05-27T14:37:21+00:00

I am trying to post information to a table and depending on if the

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:37:22+00:00Added an answer on May 27, 2026 at 2:37 pm

    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:

    if($_POST['location']!=""){
        $sql1 = "INSERT INTO names_gps (Name,Location) VALUES ('$_POST[name]','$_POST[location]')";
    

    Well it works for what I am looking for, any better way to do this?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to post into a database table, 3 different bits of information,
I'm trying to insert information from a form into a database table and then
I have a tricky situation in trying to get information from multiple queries into
I'm trying to make this information insert into my table in mysql database with
According to my previous post I am trying to get back some information from
I'm trying to use an AJAX request to load some information into a table
So basically I have been trying to insert columns into my third table from
I'm trying to aggregate some customer order data into one table for analysis. The
I've been trying to use jQuery to grab the information from $_POST and return
I'm trying to POST a http request using ajax, but getting a response from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.