How can I set the conditions on parsing this data I want?

How can I set the conditions on parsing this data I want?

I'm parsing some jsonp from an external database which I'm able to pull in fine.
However I need the data to full fill certain conditions.

The data I'm pulling in is located here: http://stuartwestgate.co.uk/final_project/index.php

and I've got the JavaScript pulling the data in:







  1. function datahandler(info) {
  2. var dataReturn = document.getElementById("dataReturn");
  3. var propertySelector = new Array("uniqueIdentifier", "cameraPicture", "photoAlbum",
  4.                                  "videoData", "audioData", "textMessage", "callData", "activityData",
  5.                                  "latitudePos", "longitudePos", "currentDate", "currentTime"); 
  6. var output = '';
  7. if(info.database[0][propertySelector[0]] == device.uuid){  //Trying to create variable for
  8.     var mobileUserLatitudeMinus = parseFloat(info.database[8][propertySelector[8]]) - 5000;
  9.     var mobileUserLatitudePlus = parseFloat(info.database[8][propertySelector[8]]) + 5000;
  10.     var mobileUserLongitudeMinus = parseFloat(info.database[9][propertySelector[9]]) - 5000;
  11.     var mobileUserLongitudePlus = parseFloat(info.database[9][propertySelector[9]]) + 5000;
  12. }
  13. else if(info.database[0][propertySelector[0]] != device.uuid){
  14.     var latitudeMinus = parseFloat(info.database[8][propertySelector[8]]);
  15.     var latitudePlus = parseFloat(info.database[8][propertySelector[8]]);
  16.     var longitudeMinus = parseFloat(info.database[9][propertySelector[9]]) ;
  17.     var longitudePlus = parseFloat(info.database[9][propertySelector[9]]);
  18. }
  19.      if((info.database[0][propertySelector[0]] == device.uuid  && info.database[10][propertySelector[10]]  == "2013-05-23")
  20.      || (info.database[0][propertySelector[0]] != device.uuid  && info.database[10][propertySelector[10]]  == "2013-05-24")
  21.            /*   && (latitudeMinus >= mobileUserLatitudeMinus) || (latitudePlus <= mobileUserLatitudePlus)
  22.                   && (longitudeMinus >= mobileUserLongitudeMinus) || (longitudePlus <= mobileUserLongitudePlus)     */        //  Bit the doesn't work
  23.            ){
  24.               
  25.                 for (var i = 0; i <= info.database.length - 1; i++){
  26.                     if(info.database[i].hasOwnProperty(propertySelector[i])){
  27.                           output += "<li>" + info.database[i][propertySelector[i]] + "</li>";
  28.                     }else{
  29.                         //alert();
  30.                     }
  31.                 }
  32.                 dataReturn.innerHTML += output;
  33.                
  34.      }
  35.        
  36. }//dataHandler function end



I want to get the users device.uuid which is unique to them and query a certain date and return all there data on the database which it does fine.

Then I want to do the same for any other user that's on the database who device.uuid != to mine and also query the same date, and the location they where at when uploading their media.

Basically I want to return all the users data that were in the same location as me when they uploaded their media.

When it comes to the location part it just doesn't work and I have no idea why.

This is the location part which I commented out for the moment.













  1. /*       && (latitudeMinus >= mobileUserLatitudeMinus) || (latitudePlus <= mobileUserLatitudePlus)
  2.            && (longitudeMinus >= mobileUserLongitudeMinus) || (longitudePlus <= mobileUserLongitudePlus)      */


Have you got any idea to what maybe cause the problem or saying that what I'm doing wrong ha ha