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

  • SEARCH
  • Home
  • 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 8228945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:37:55+00:00 2026-06-07T16:37:55+00:00

my problem is this one, I have a javascript code that gets GPS location

  • 0

my problem is this one, I have a javascript code that gets GPS location from a browser. Then, because I can’t write those coordinates to SQL database from javascript and I can’t send it directly to php, I go to the controller “site” and it’s method “writeToDatabase” and I also add 4 segments to URL that are actually those coordinates that I got from javascript..

so in javascript I have:

window.location = getBaseURL() + "site/writeToDatabase/" + splittedLatitude[0] + "/" + splittedLatitude[1]
        + "/" + splittedLongitude[0] + "/" + splittedLongitude[1] + "/";

so now the browser goes to (just an example with fake coordinates) http://www.mysite.com/index.php/site/writeToDatabase/47/707223/16/054322

now my writeToDatabase method in site controller reads those segments (I use codeigniter so it is really easy to read segments of URL). After I read segments, I concat first part of latitude and second part of latitude, and also put a dot “.” in between (so in this example I get 47.707223 and 16.54322), and I do the same with the longitude.. then when I write those data to database, I get weird numbers in my database, also if one of my segments begins with zero (just like in my example above), the zero gets removed so from 054322 I get 54322, and that leads to 16.54322 just like in the example above 🙂

now this problem with strange numbers only occurs if I try to write to database whole coordinates.. if I just write first part of longitude, or just second part of longitude (same goes for latitude) everything goes well and correct value gets written..

anyone else has a solution to this problem? I’m all out of ideas

  • 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-06-07T16:37:57+00:00Added an answer on June 7, 2026 at 4:37 pm

    Why don’t you just send the parameters as they are like this:

    http://www.example.com/foo/bar/?lat=47.11&lng=5.012
    

    That does fix that issue.

    However you can do it your way (since these are strings not integers) with simple string concatenation like this.

    $lat = $_GET['first'] . '.' . $_GET['second];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my aspx file, I have some code that looks like this: <script type=text/javascript>
I have a small bit of code that gets my images from smugmug. My
I have one boomarklet, means javascript code that takes current page's source, search for
I have this function in my Javascript Code that updates html fields with their
I really have problem with this one. So I have a jar with a
My problem is this one, I am using Sharepoint 2010, I have a form
I have a problem with my WCF Data Service, and this one is just
This is my problem, I have one textbox, one button and one label. Everything
This is a thought problem, and one I have been wrestling with for about
So i'm having this problem. I have two tables (Oracle), one is called Destination

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.