How to set up the Gps Tracker MySql database using phpMyAdmin

This problem has plagued a lot of people. I even made a video in 2008 explaining how to use phpMyAdmin. I just watched it again and it’s still relevant 6 years later. Check out the video on my youtube channel, it’s only four minutes and will help:

Google Map GPS Cell Phone Tracker and PhpMyAdmin

The following are the written instructions for those who prefer it. The first thing you need to do is create a new database. When you have the name of the database, make sure and change it in the php connection file:

https://github.com/nickfox/GpsTracker/blob/master/servers/php/dbconnect.php

$dbhost = 'localhost';
$dbuser = 'gpstracker_user';
$dbpass = 'gpstracker';
$dbname = 'gpstracker';

You need to make sure all those values are correct.

Next take a look at the sql script in the github repo, you’ll first want to cut and paste the CREATE TABLE command into the SQL tab of phpMyAdmin. After you’ve created the table, you’ll want to add all the stored procedures. When you look in the sql script, you’ll see something like this for the procedure prcGetRouteForMap:

CREATE DEFINER=`root`@`localhost` PROCEDURE `prcGetRouteForMap`(

This is generated automatically by mySql but should not be used if you are creating the procedure by hand. This is how the procedure should be run:

CREATE PROCEDURE prcGetRouteForMap(
_sessionID VARCHAR(50),
_phoneNumber VARCHAR(50))
BEGIN
  SELECT
  CONCAT('{ "latitude":"', CAST(latitude AS CHAR),'", "longitude":"', CAST(longitude AS CHAR), '", "speed":"', CAST(speed AS CHAR), '", "direction":"', CAST(direction AS CHAR), '", "distance":"', CAST(distance AS CHAR), '", "locationMethod":"', locationMethod, '", "gpsTime":"', DATE_FORMAT(gpsTime, '%b %e %Y %h:%i%p'), '", "phoneNumber":"', phoneNumber, '", "sessionID":"', CAST(sessionID AS CHAR), '", "accuracy":"', CAST(accuracy AS CHAR), '", "extraInfo":"', extraInfo, '" }') json
  FROM gpslocations
  WHERE sessionID = _sessionID
  AND phoneNumber = _phoneNumber
  ORDER BY lastupdate;
END

Note that the DEFINER is now gone. Now look in the lower left hand corner of the SQL tab of phpMyAdmin. Do you see the delimiter box? Remove the semi-colon ; if there is one and add two forward slashes // to the box. Do this for each of the stored procedures (total of 6) and you’re almost done. Finally do the INSERT INTO command and insert the location data into the db. Now are you done setting up the database. The next step is to test your installation by going to the following page:

http://www.yoursite.com/gpstracker/displaymap.php

on your website. You should see the red message at top saying “Choose a route below” and with that you should be good to go. Just point one of the phone clients to your updatelocation.php file and start receiving updates.

103 thoughts on “How to set up the Gps Tracker MySql database using phpMyAdmin

  1. Tanihera

    Hi Nick

    I’m mighty grateful for you sharing this – many many thanks. The windows phone version deployed easily to my Lumia 625 and runs well using your test website.

    The webserver I’m setting up offers cPanel for site admin, but no access to a shell. It offers phpmyadmin through which I tried to import the gpstracker-03-14-14.sql file as a database, but it fails with error #1046 – ‘No database selected’.

    I wonder if you’ve written instructions for a cPanel install? Alternatively, is there a spec for the database as cPanel is happy for me to create a new database?

    Cheers

    Reply
    1. Nick Fox Post author

      Hi Tanihera

      You’ve hit upon one of the reasons why I don’t use phpMyAdmin. The other reason is that it doesn’t work well with stored procedures. I think the easiest thing to do is to create a gpstracker database with phpMyAdmin and then create the table using their interface. If you look in the gpstracker.sql file here on github you will see the CREATE TABLE procedure, run that and then after that run the CREATE PROCEDURE procedures. There aren’t very many, like 5-7 or so. I think you need to run that on the SQL tab in phpMyAdmin. You should be done then.

      Let me know how that goes.
      Nick

      Reply
  2. Tanihera

    Many thanks Nick

    I have my phpMyAdmin website working now, thanks to your suggesting the removal of the DEFINES expressions. There’s few other minor tweaks, but no other significant issues.

    I suspect I’ll need to revisit database security at some point – as it stands maybe anyone can delete anyone else’s routes, etc etc. I need to do some tests.

    I’ve started a write up which I expect to post in a few days. 🙂

    Reply
  3. Roger

    hello Mr.Nick
    $dbhost = ‘mysql2.000webhost.com’;
    $dbuser = ‘a2561207_user’;
    $dbpass = ‘xxxx’;
    $dbname = ‘a2561207_find’;

    but the db i only create the tables and didnt do anythings else !

    Reply
  4. carl

    Hi – I’m going to try this out. I have a hosted site, so i can use CPANEL and PHPADMIN. It seems what i need to is use PHPADMIN to create the SQL database, then assign a user. Then use CPANEL to create the directory and copy the PHP code. Then install the app on my Android.

    Let me know if i’m missing something (first time i’ve tried something like this so i might be way off).

    thanks

    Reply
    1. Nick Fox Post author

      Hey Carl

      I moved your comment over to this post. Follow the instructions here and let me know how it works out.

      Nick

      Reply
  5. Tanihera

    Setting up gpsTracker on a “virtual host” website with cPanel admin and no shell access.
    Caveats:
    • My hosting provider calls their service “virtual hosting”, which it may not be to other people, and may not be what others are trying to set up. Nevertheless, I hope the steps outlined here might still be helpful.
    • I’m working in Windows and am a minnow when it comes to websites……
    Issues:
    • On a virtual host website you don’t get access to root or a shell
    • Site admin access may be via a specific port, requiring a “pinhole” in your firewall
    • MySql may be already installed and available
    • It may not be possible to use “gpstracker” as the database name
    • The .SQL file may need to be edited, and/or new access permissions established
    • The dbConnect.php file may need to be edited to reflect the names above
    Synopsis:
    1. Have the chosen ISP set up the basic website with known login credentials
    2. open a pinhole in your client firewall
    3. Set up webdisk on the admin client to provide easy access to the website root (or FileZilla, puTTY, etc)
    4. copy files to the site using the webdisk or ftp
    5. edit a couple of the project files.
    6. create and populate the mySql database
    Assumptions:
    Your hosting service has set up your website and provided its IP address, possibly in the form http://hostIPaddress:port#/ or http://hostIPaddress/~yourname/. If you also completed domain registration, it can take up to 24 hours propagate. Until then, use the former url form.
    Your hosting service will have also provided admin login details for cPanel and ftp file access. You may also have been sent a script or other means of installing a drag-‘n-drop “webdisk” file access facility.
    If you can access both of the above URLs, i.e. if you are prompted for username and password when you try the above URLs, then you should not need to perform the firewall pinhole step next.
    The steps below describe working on the server files via webdisk or ftp, not the local files.
    Firewall pinhole:
    A port pinhole may be required through the local client firewall for the Webdisk and cPanel on a port number provided by your host as mentioned above.
    The pinhole is enabled through ControlPanel/WindowsFirewall/Advanced settings. In the Windows Firewall with Advanced Security dialog box, in the left pane, click Inbound Rules, and then, in the right pane, click New Rule.
    A second application pinhole for puTTY and/or ftp client may be required on port 20.
    Setting up the webdisk:
    A “webdisk” is a virtual disk visible and accessible in file Explorer on which is mounted the website file structure. It’s a very convenient substitute for ftp file maintenance and transfers to the website.
    Your host provider should facilitate setting this up.
    Following the cPanel setup wizard:
    Open your website in a browser as http://yourhostIp:port or http://www.yourdomain:port, and supply your host login details. Your cPanel control panel opens with a Getting Started wizard.
    Follow the wizard through: Section 11 (the last section) starts an SSH key generator. It may insert your name_ID; provide a password. This generates an access key-pair; the public key remains on the server, your personal key is saved somewhere I guess (I didn’t get to see or save it).
    The cPanel wizard closes on the cPanel homepage, giving access to site admin tools and facilities.
    File transfer to the website:
    As per Nick’s instructions, create a gpstracker directory in the website public directory and drop the complete stack of files into it via webdisk or ftp client..From here on, all steps are performed on the website files, not your local copies.
    Set up the MySQL database:
    It may not be possible to create a database named “gpstracker”, and this is the pivotal issue being addressed here.
    Before creating your database, view the dbconnect.php script to see the parameters needed to connect to it: database name, username and password. Some virtual hosts restrict these names to forms such as mydomain_suffix, and the names you choose will need to be edited into the dbconnect.php script once the database is created.
    The virtual host probably already has mySql facilities running. There are several cPanel steps to replicating the required database functionality.
    1. From cPanel home, create an empty database:
    a. Open Databases=>MySqlDatabases, create a new database named “gpstracker” if possible, but you may be restricted to use a name of the form “yourdomain_databasename”
    b. Create a user for the database: this may have to be in the form “yourdomain_username”, password “gpstracker”
    c. Add this user to the database in the section provided
    2. The gpstracker-03-14-14.sql file creates six procedures with statements of the form
    CREATE DEFINER=`root`@`localhost` PROCEDURE `prcDeleteRoute`
    which imply root access. Using Notepad++ or other hex editor (not M$ notepad), edit each of these lines to remove the DEFINER subclause, reducing the line to
    CREATE PROCEDURE `prcDeleteRoute` etc
    Do not change the table name “gpslocations”.
    3. Now populate the empty database above using the edited .sql file:
    a. copy the entire contents of the file to your clipboard
    b. From cPanel home, open Databases=> phpMyAdmin
    c. Under the Databases tab, select the database created above
    d. Under the SQL tab, paste the entire sql file into the SQL query box
    e. Hit the Go button beneath
    4. Edit the dbConnect.php file to reflect the database name and user details chosen above
    You’re done! This should now work as per Nick’s prototype.
    Future step:
    Note: Nick has two user levels in the DEFINER subclauses, `root`@`localhost` and `gpstracker_user`@`localhost`. Omitting these statements may compromise database security. It may be propitious to add a second user in step 1 above and experiment with assigning the two equivalent permission levels.
    You may want to choose what security you want for *your* project. My host provider suggested “…use database username in place of ‘root’, and leave @’localhost’ as is”, but I didn’t find this or any variation of it would run without error in step 2 above. If anyone resolves this, please post accordingly 🙂
    Good luck!
    tanihera

    Reply
  6. carl

    I installed the app on my android. No problem.

    I followed Tanihera excellent instructions to setup the server side. I had no problems with that (that i’m aware of right now anyway)

    However, so far I haven’t been able to get gpstracker to do anything.

    http://stevelescure.net/myhome/gpstracker/displaymap.php

    the “routes” are all empty. I’ve got to stop for today, but if anybody has an idea how to debug let me know (I’m new at this so it could be something very basic)

    Reply
  7. carl

    I think I’m getting closer to getting this working. I can see the table gpslocations is now being updated.

    However, I’m having an issue with displaying the routes.

    http://stevelescure.net/myhome/gpstracker/displaymap.php

    If I display the console in Chrome (CNTL+Shift+J), i see an error.

    { “routes”: [{ “sessionID”: “a8811646-0074-4747-8142-1fbdcc3f0294”, “phoneNumber”: “slescure”, “times”: “(May 21 2014 10:12AM – May 21 2014 10:12AM)” }] } displaymap.php:60
    status: 200 displaymap.php:61
    errorThrown: SyntaxError: Unexpected token w (message is cut-off at this point)

    No idea what to make of that. Any ideas?

    thanks

    Reply
  8. Kishan

    Hi Nick,

    Great work on the app! However, I am facing some issues with displaying the map on my website. I noticed that the data is inserted into the database, but, it does not display on the website. I have created all the procedures as stated and followed instructions as stated above. My website is:

    http://www.craftan.co.tz/gps/displaymap.php

    I am using cpanel to manage the database via phpmyadmin. Any ideas/suggestions as to why it may not be working? I have read the comments and suggestions by other users above, and tried the solutions they gave, but it is still not working.

    Your suggestions will be highly appreciated.

    Kishan.

    Reply
  9. Kishan

    Hi Carl,

    I am facing a similar problem. My database is updating however the map does not display.

    Any suggestions? If I display the console in Firefox, I get the following errors:

    “responseText: error: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation ‘='” displaymap.php:58
    “status: 200” displaymap.php:59
    “errorThrown: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data” displaymap.php:60
    GET http://maps.googleapis.com/maps/api/js/AuthenticationService.Authenticate

    Kindly suggest.

    Thanks.

    Reply
  10. Kishan

    Hi.

    I figured out why nothing was displaying on the map. Turns out, my default collation on phpmyadmin was set to UTF-8 Unicode and while importing the sql file provided in the folder on github, the table was created in UTF-8 General. As soon as I deleted the table an manually created it in UTF-8 Unicode, the page picked up the maps immediately.

    Hope this helps for others who might face a similar problem.

    Reply
  11. Isuru Chamara

    Hey nick,
    I have set up the server using phpMyAdmin and wamp server. Also set up the mysql database as you mentioned above. but when I go to “http://localhost/gpstracker/displaymap.php” , drop down menu corresponding to display routes does not show routes in the database. When I click that menu, it just does not responds. What should I do? how am I get my local server to work ? please help
    Isuru

    Reply
  12. Isuru Chamara

    Hey nick,
    how did you host your server to work with the google map? Can we use locations in google map in localhost? or should we host it to use google maps? please help me out
    Isuru

    Reply
    1. Nick Fox Post author

      Isuru, please note that I do not answer setup questions through email. I simply have too many people requesting help and I very quickly get overwhelmed by people wanting my help but not wanting to pay me for it. It sounds like you have not setup the correct database name and password information in dbconnect.php. Please read the php section above for details.

      n

      Reply
  13. David Marks

    Nick, I have had my ISP install the server software for me using your instructions. I have been able to connect with my cell phone to post data to it (at least I didn’t get any error messages on the cell phone). When I go to my site to see what I have created all I get is the first three lines plus a rotating “I’m loading please wait” icon. I am guessing that there is something wrong with the database. I noted that when I transferred the gsptracker-03-14-14.sql file its length was 14,319 rather than its original size of 14,355. I assumed that what was missing were null characters at the end of the file as this is not unusual.

    Reply
    1. Nick Fox Post author

      David, it hard to tell. What is the url where you have displaymap.php hosted? It sounds like the database name and password are not set up correctly in dbconnect.php.

      n

      Reply
  14. David Marks

    Nick, the ISP tech did what you suggested but still no joy. He has also checked to make sure that he can access the database and has had no problems with that either. He emailed me the following: “I just logged in manually using the credentials in your dbconnect.php file without issues. The credentials are good.” He would also like to know how you got the error message because we cannot get it. I have tried website/gpstracker/displaymap.php in MS Internet explorer, Firefox and Google Chrome and get the same result every time. I had added in the latitude and longitude display and thought that might be the issue so I removed those lines and still get the same result. I know that this has to be something simple but I don’t know what to tell the ISP techies at this point. If you contact me via email I will be happy to give you access to the site.

    Reply
      1. David Marks

        Nick, I had the ISP reload the database and that seems to have helped a lot. At least it isn’t hanging any more. I was able to load my location into the database using my cell phone and then find it in the Select Route drop down list. When I do so in Firefox using google maps I get a very thin map and if I use bing or open street I get mixed up sections of the maps. When I use Internet explorer and google chrome I get the same results. Is it possible that one of the files I down loaded was corrupted? If so which ones should I look at? If it matters, I am running a Windows 7 Home system and it is completely up to date. I don’t know what the ISP is running other than a unix system.

        Reply
  15. Ramon

    Hi, Nick…
    First of all, is to give you a BIG THANKS for everything you have done… I am very new in PHP, but I have some knowledge of programming so I follow my instincts. Your scripts are working really fine with me, BUT there is something that I will like to change… I don’t want the info be repeated every time.. I mean, all I want is a kind of update, ex… Celphone1 was registered at 2:00 pm and celphone2 was at 2:15, so if Celphone1 is registered again at 2:30, I will like just an update of its location, and the same for celphone2 at 2:40. In that way, only will be two records for that day in my table. If I add celphon3, and is not registered yet, so it will be added and now I will have only 3 rows in my table…
    I have tried with so many way, and it has been really difficult to me…
    I have tryed in 4 different ways like :

    $query = mysqli_query($mysqli,”SELECT * FROM gpslocations WHERE phoneNumber = $phoneNumber LIMIT 1″);
    $count=mysqli_num_rows($query);
    if ($count==1) {

    =============================
    if (($result = $mysqli->query(“SELECT * FROM gpslocations WHERE phoneNumber = $phoneNumber”)) === true) {

    ………..
    And the only thing I get is the Insert…
    PS : I m using my own insert and my own update, so this :
    $query = ‘CALL prcSaveGPSLocation(\’
    is blocked at this time…
    If you have a better way to do what I need it will be appreciate..
    I have 2 days trying to do it by myself, but it looks like Im done 🙁

    Reply
    1. Nick Fox Post author

      Hey Ramon

      I’m just going to give you the pseudocode of one way to do it and you will have to figure out the sql but I think this will work.

      insert gpslocation into table where sessionID not in (select sessionID from table)

      gpslocation will include latitude, longitude, sessionID, speed etc. The unique identifier is sessionID, so if it’s already in the table then don’t insert another row. Does that make sense?

      n

      Reply
      1. Ramon

        Hi Nick thanks for your really quick response…
        I have never worked with Store Procedures and I will like to work as it was at the beginning, the way you did it, but I don’t want to damage something that is working fine, so my question is, this is how you think it could work ?
        BEGIN
        INSERT INTO gpslocations (latitude, longitude, speed, direction, distance, gpsTime, locationMethod, phoneNumber, sessionID, accuracy, extraInfo, eventType)
        VALUES (_lat, _lng, _mph, _direction, _distance, _date, _locationMethod, _phoneNumber, _sessionID, _accuracy, _extraInfo, _eventType) where _sessionID not in (select sessionID from gpslocations);
        END

        I tried with that, but it gave me an error in SQL and that script was not saved in the Store Procedure

        Reply
        1. Nick Fox Post author

          Yes, it was my bad. The insert statement should not have the where clause. They should be in two statements. You can do it in one stored procedure by first checking if the sessionID is in the table and if it’s not, then do the insert. Or you can do it in two separate calls if you are not used to working with stored procedures.

          Also, if you are only wanting to get the first location, you should turn off tracking on the phone after the insert into the database.

          n

          Reply
          1. Ramon

            “In one stored procedure by first checking if the sessionID is in the table and if it’s not, then do the insert.”
            I think that could be the way it will work for me, I will try to read more about the Store Procedure just to do it like that… And remember, about this :
            “Also, if you are only wanting to get the first location, you should turn off tracking on the phone after the insert into the database.”
            No, I will like always an update of it position… I mean, always has to be on, working…. but, if I can not do it like the way I want using the Store Procedure, I will leave it like that, and then I will try get the better of it…
            Thanks anyway for your support… By the way, if you see something in paypal sent for [email protected]…. that was me 🙂
            Thanks

  16. Tony T

    Hi Nick I am successfully using the app and it really works great! But I need to create some more functionality. i.e: delete route (driver), leaflet (are modifications and updates possible here, visual affects?), any new maps, etc 🙂 I also want to move the map to a password page, will that be an issue for any of the dbconnections? If these questions have been answered I apologize, please direct me to those resources.
    -Tony

    Reply
    1. Nick Fox Post author

      Tony, answers below.

      Hi Nick I am successfully using the app and it really works great! But I need to create some more functionality. i.e: delete route (driver)

      You need to go into map.js and uncomment the code in the delete section. It should work fine.

      leaflet (are modifications and updates possible here, visual affects?), any new maps, etc

      there are plenty of leaflet maps and modifications but you need to go to the leaflet website and study.

      I also want to move the map to a password page, will that be an issue for any of the dbconnections?

      the page that the phone uses called updatelocations.php (I think it’s called) needs to be accessible from the phone, if you put that behind a password page, then the phone app needs to be modified. The rest of the pages should work behind a password.

      n

      Reply
      1. Tony T

        Great! that worked. OK now a new issued I have discovered: Tracking wont turn off. I have my smart phone set to “Tracking is off” but it is still showing me on the map when I refresh the page, as if I started a new instance of tracking. Did you get any response from the referral I sent you?
        Again I wanna say how awesome this package is. I will be making a donation in the near future. Thank you for all this hard work.

        Reply
        1. Nick Fox Post author

          Tony

          You need to attach your phone to Android Studio and Log.e the LocationService and see what’s going on.

          n

          Reply
  17. TonyT

    Hi Nick…well using the Android Studio is way out of my scope of expertise. I guess I just have to wait until there is an update to my issue and hope for the best. Thanks

    Reply
  18. Comm

    Thank you for your work on this product.

    We have installed and initially got this error when launching getroutes.php

    error: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation ‘=’

    We fixed the error by making sure all tables were utf8_general

    We are now getting same error when launching getgpslocations.php

    Since the database collations were fixed, we do not understand where this error may be coming from.

    Can you shed some light on where to begin troubleshooting please?

    Reply
    1. Nick Fox Post author

      I’m not sure what your data looks like but it appears to be a different collation than what the table is set up for. I think you need to read some of the stackoverflow answers here:

      https://www.google.com/search?q=Illegal+mix+of+collations+(utf8_general_ci%2CIMPLICIT)+and+(utf8_unicode_ci%2CIMPLICIT)&oq=Illegal+mix+of+collations+(utf8_general_ci%2CIMPLICIT)+and+(utf8_unicode_ci%2CIMPLICIT)&aqs=chrome..69i57&sourceid=chrome&es_sm=119&ie=UTF-8

      n

      Reply
  19. TonyT

    I cant find info on updating gps tracker pHp Version 3 to Ver 4. I currently have a working version 3 on my server and would like to update, I don’t see any information on how to do that. I

    Reply
    1. Nick Fox Post author

      Tony

      I haven’t created an easy upgrade path. The new database needs to be installed with the new pages. The two apps are really quite different. The newer one is much, much better and will not change for a long time now. I have completed the wordpress version but will not release on github until I have released it to wordpress first.

      n

      Reply
      1. Tonyt

        What I wanted to confirm because you are not quite saying it. I need to delete my current setup and start from scratch? And if it so, since it is so different where are the instructions for installing on mysql, my own server… the way I have it now OR can I just FTP most of the NEW pages and overwrite what I currently have without starting over? The word press setup would resolve all these issues completely. That would be awesome. I sent a small donation… I will send more but I really need help. My customers LOVE this and it really has become a needed tool. Please advise.

        Reply
        1. Nick Fox Post author

          Yes, the wordpress install will solve all of these problems but still working on it. The easiest way to move forward is backup your current database and then reinstall from scratch. I would then ask your users to update the apps on their phones. If you really need the old data, you will need to add a userName field to the old data and import it. It’s a one time operation and this will not happen again.

          n

          Reply
  20. excel

    hello, please am working on a final yr project and i want to create a tracking system that allows yopu locate an android device when it comes online and shows it current location. please i would really need help on this because i don’t know how to start or what to do. any suggestions please will do thanks.

    Reply
    1. Nick Fox Post author

      I don’t understand. You are doing your senior project and you have no idea what to do? What class is this for?

      n

      Reply
  21. Angel

    Hi Nick,

    Awesome work you’ve done!

    I have one question for you.

    I’ve set up the DB as described edited the dbconnect.php with the username and password.

    The map displays the data fine.

    However, the dropdown remains empty.

    Can you help?

    Reply
  22. me

    hi nick I’ using PHPadmin in xamp..I try to fallow your instruction in removing difiner..some SQL procedure work fine but I could not update and save data in my database using
    prcSavelocation

    Reply
    1. Nick Fox Post author

      Hi

      Did you try to save data using the browser first?

      https://www.websmithing.com/gpstracker/UpdateLocation.aspx?longitude=-122.0214996&latitude=47.4758847&extrainfo=0&username=momo&distance=0.012262854&date=2014-09-16%2B17%253A49%253A57&direction=0&accuracy=65&phonenumber=867-5309&eventtype=android&sessionid=0a6dfd74-df4d-466e-b1b8-23234ef57512&speed=0&locationmethod=fused

      try using that and replacing my website for yours. If it’s working correctly, you should get a date back and a row put into your database.

      n

      Reply
  23. Pratik sharma

    Hi Nick,
    Followed your steps for installation but i’m not fully okay with that.
    I’m not able to see the maps and aslo the drop down list on my site, the url for my site is http://www.puissant.in/php/displaymap.php will you please help me to solve my issue and also i’ve changed the $dgho $dbuser $dbpass $dbname with my user names and passwords.
    please help.

    Thanks in advance.

    Reply
  24. Pascal

    Hie Nick,

    Thank you so much for the great job you are doing.

    I have set up my server as described above and also the android application is working fine since i have tested with your test website, however i am unable to use the app together with my site running on local host. My server and my phone are connected to the same wife and here is the url i put to the app:
    http://127.0.0.1/gpstracker/updatelocation.php
    Please tell me wher i am getting it all wrong.

    Reply
    1. Nick Fox Post author

      Pascal

      I know for a fact that GpsTracker works on private networks using wifi. I’ve done it myself. Unfortunately, I am unable to troubleshoot software since I can’t see what’s going on. I will tell you this though, the vast majority of problems are incorrect credentials in dbconnect.php.

      n

      Reply
  25. Pratik sharma

    Hi Nick,
    Followed your steps for installation but i’m not fully okay with that.
    I’m not able to see the maps and aslo the drop down list on my site, the url for my site is http://www.puissant.in/php/displaymap.php will you please help me to solve my issue and also i’ve changed the $dbho $dbuser $dbpass $dbname with my user names and passwords.
    please help.

    Thanks in advance.

    Reply
  26. Pratik sharma

    Hi sir,
    I followed the steps for the installation and successfully installed the project using localhost but there seems to be an issue while using the website server. The url of my site is http://www.puissant.in/gpstracker/php/displaymap.php i’m not able to see the map and also there is no dropdown list.
    I have made changes in the dbconnect.php as –
    PDO::ERRMODE_EXCEPTION,
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC);
    $dbname = ‘gpstrkr’;

    $pdo = new PDO(‘mysql:host=gpstrkr.db.11771057.hostedresource.com;dbname=gpstrkr;charset=utf8’, $dbuser, $dbpass, $params);

    ?>

    Also renamed the sql script from localhost and root to gpstrkr and gpstrkr.db.11771057.hostedresource.com respectively .
    Can you please help me.

    Thank you in advance.

    Reply
    1. Nick Fox Post author

      Pratik

      I asked you two specific questions in my last comment and you didn’t answer either of them.

      n

      Reply
      1. Pratik sharma

        Yes sir it is giving an error as ‘Syntax error or access violation’, the number of arguments that the PROCEDURE gpstrkr.prcGetRoutes is supposed to get are two but it is getting zero. Please help me where i am wrong.

        Reply
        1. Pratik

          I AM GETTING THIS,
          Fatal error: Uncaught exception ‘PDOException’ with message ‘SQLSTATE[42000]: Syntax error or access violation: 1318 Incorrect number of arguments for PROCEDURE gpstrkr.prcGetRoutes; expected 2, got 0’ in /home/content/57/11771057/html/gpstracker/php/getroutes.php:5 Stack trace: #0 /home/content/57/11771057/html/gpstracker/php/getroutes.php(5): PDOStatement->execute() #1 {main} thrown in /home/content/57/11771057/html/gpstracker/php/getroutes.php on line 5

          Reply
          1. Nick Fox Post author

            Pratik

            I don’t mean to be rude but I have asked you a question 2 times now and you still have not answered it. So I will ask one last time.

            1) did you change getroutes.php in any way? If so, how?

            2) did you change the stored procedure prcGetRoutes in any way? If so, how?

            n

  27. Pratik sharma

    1) getroutes.php is intact sir
    2) coming to stored procedure prcGetRoutes, `root`@`localhost` is replaced with `gpstrkr`@`gpstrkr.db.11771057.hostedresource.com`

    PLEASE LET ME KNOW SIR WHERE AM I GOING WRONG! PLEASE DO THE NEEDFUL…

    Reply
    1. Nick Fox Post author

      Pratik

      I’m sorry but I don’t know what’s wrong. The reason I asked if you had changed that stored procedure is because the error message says that prcGetRoutes has the incorrect number of arguments. But prcGetRoutes takes no arguments and never has which led me to believe that it had been altered. Without seeing all the code myself, I have no way of troubleshooting this problem.

      n

      Reply
  28. Pratik sharma

    Sir one issue i came accross is that when i create definer ‘prcDeleteRoute’ following your instructions mentioned in ‘How to set up the Gps Tracker MySql database using phpMyAdmin’, the PROCEDURE is created for a while but disappears automatically. What is this issue sir? Is it related with not displaying of the map and the dropdownlist? And the remaining four PROCEDURE are created too but they do not disapper. Whats wrong with the prcDeleteRoute

    Reply
    1. Nick Fox Post author

      Pratik

      Developers have downloaded GpsTracker close to a million and 1/2 times. Do you really think there is something wrong with that stored procedure?

      n

      Reply
      1. Pratik sharma

        Pardon me sir, but i’m just in a search of a solution for my problem. Kindly guide me wherever i’m going wrong. I really do not mean to say anything related to your project. But it would really have been very much helpful for me if you guide me as i’m a junior and you having mastery in project. My project works fine in localhost but not on the web server, as mentioned by you i changed the dbconnect.php and also the gpstracker-09-14-14.sql(root and localhost replaced with gprtrkr and gpstrkr.db.11771057.hostedresource.com respectively). Please help me SIR

        Reply
  29. cyprian

    hello Nick Fox, i have been able to setup the server-side software correctly by following the instructions in the tutorial notes but the drop down only shows 3 examples whereas in the db i can see more than 3. also i installed gprstracker from google play but it is neither updating to your website nor to my website. i know its something minor before i get it to work, your help will be greatly appreciated and ill be sure to donate for the amazing work.

    Reply
  30. Stefan

    Hi Nick,

    First of all. GREAT WORK … Installed your application and it works great.

    Question: As alternative to using a cell phone, I want to use my Ardruino connected to a GPS mod and GPRS/GSM modem to send the data to the updatelocation.php page. The one thing though, is that the GSM module does not create session ID’s. How important is the session ID’s in the application, and can I substitute the session ID with my own pre defined ID code, lets say the IMEI number of my GSM module. I assume the session ID must be unique to every user.

    S

    Reply
    1. Nick Fox Post author

      Hey Stefan

      Having a unique ID of some kind is important to the app. There are actually 2 unique ID’s, one is the appID and the other is the sessionID. The appID is unique to every phone (or user). The sessionID is unique to each session (or time you press start start tracking until you press stop tracking). They both use UUID’s which are common to a lot of different programming languages so you need to figure out some kind of workaround for that…

      n

      Reply
      1. Stefan

        Hi Nic,

        What if I use some kind of CRC algorithm to generate both the UUID’s Will not be 128 bit though. Lets say the appID will be made up from the mobile IMEI number, and the session ID will be made up of the Date+ StartTime of the tracking session. I have checked out the data against these UUID’s on the database, and it seems that they stay the same for every entry per session. So if I do a second tracking session, will only the session ID change. The idea is to enable and disable the GSM tracker by a SMS. So, I can activate the tracker at any time when needed.

        ( Still working on this) … I also want to capture the tracking info on the GSM mod on a SD card to a text file, and then on request from the user by a SMS command, upload the text file to the server via FTP, and then import the data to the database to be displayed.

        Reply
        1. Nick Fox Post author

          The imei would be fine to use for the appID. But not all phones have an accessible imei, I don’t think you can get it from iphones any longer. But if you can get it, it would work fine. For the sessionID, I think using the imei and the date/time together in one string (concatenated) would work alright. It will always be unique.

          n

          Reply
  31. Mark

    hey i’m using php and mysql script. but i don’t know how to setup i mean how can i locate a phone number or register user to track a number?

    Reply
    1. Nick Fox Post author

      Mark

      You have to put tracking software on a person’s phone if you want to track them or know their location. Please read my “quick start guide for gps tracker” tutorial.

      n

      Reply
  32. David Marks

    Nick,
    I took another shot at installing GpsTracker and discovered that doing so to a clean site makes it a lot easier to fix my fumble fingered errors. I now have it installed and am at the point of testing it with your pre-loaded data. It is working fine in Firefox (though not in IE – the map does not display) except that when I point to any location plot all I get is the date and time. I have added the following lines of code after line 259 in maps.js:
    “latitude:” + latitude + “” +
    “longitude:” + longitude + “” +
    It is interesting to note that I also don’t get speed and distance showing up either. I suspect that I have missed something obvious. Could you please direct me to the solution?

    Reply
  33. David Marks

    Nick,
    The lines of code that I added were:
    “$lt;tr>$lt;td align=right>latitude:$lt;/td>$lt;td>” + latitude + “$lt;/td>” +
    “$lt;tr>$lt;td align=right>longitude:$lt;/td>$lt;td>” + longitude + “$lt;/td>” +

    Reply
    1. David Marks

      Nick,
      Please disregard my comment about the latitude and longitude not showing up. It turns out I just had to left click on the icon. I knew I was missing something obvious. I still don’t know why it won’t work on IE. Admittedly I don’t use IE very often. Is it possible that I haven’t loaded something into it?

      Reply
          1. David Marks

            Have come across another possible issue. When testing I turned tracking on my cell phone and walked about inside a building. When I went to check the map there wasn’t even an entry for the exercise. We couldn’t figure out what was going on since it had worked before when I went for a walk around the block. I then turned it on and went for a long drive using the same settings and lo and behold it worked perfectly. Does the updatelocation program not record anything until it detects actual movement? That is the only thing I can think of that could cause this.

    1. Nick Fox Post author

      There are no guarantees at all that any cell phone gps will work inside a building. You will also see problems if you live around tall buildings, lots of trees or even during periods of bad weather. Anything that blocks reception from satellites is going to negatively affect reception by the phone. See if you can start seeing where you lose reception and if you can see a pattern.

      n

      Reply
  34. Humza

    Hi , i follow your tutorial and it was very awesome and it worked for me . I want to ask how can i draw polylines between markersm of specific route.

    Reply
        1. Nick Fox Post author

          not totally sure, haven’t worked with polylines for a very long time. That polylines.getBounds() does not look like it should be there. Did you try commenting out that line?

          n

          Reply
  35. Joe

    Hi Nick,
    thank you for your great work! I tried to install your code on my server. But I’m stuck. I can see your map setup, but no map. And getroutes.php is not working. I would need some help :-).
    I’ve uploaded all from php folder and set up the mysql tables (according your instructions; video). The dbconnect.php is not self-explaining to me.
    I changed $dbType = DB_MYSQL; and inserted my mysql logindata in $dbuser = ‘username’;
    $dbpass = ‘password’.
    Should I change dbname=gpslocations to my databasename, or should I live it like it is. Isn’t it necessary to put in my database name?
    And I did the setup without wamp… Could that be the failure? I don’t know how to handle wamp or lamp.
    If you need me homepage, I’ll provide these details to you.
    Thank you for your help :-), Joe

    Reply
  36. Joe

    Hey Nick,
    your project works now flawless on my Server.
    The problem was related to my webhosting provider. Great job!

    Reply
  37. susun

    Please, I need a best web hosting for gpstracker supporting routines and PDO enabled
    wich is compatible with this

    Reply
  38. sandhya

    hi ,
    Your project is working fine.. but problem is it does not showing map while selecting google map ,but open street map is showing .can you please tell me whats the problem is,however the tracker markers showing.

    Reply
  39. David Marks

    Nick, once I obtain my Google API key where do I go in the code to insert it. Also, if I am having difficulty with this how do I go about making OpenStreetMaps the default? If you have already answered this for others please point me to your response. Thank you so much for this.

    Reply

Leave a Reply to Nick Fox Cancel reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.