Connecting to a remote database...

Discussion in 'iOS Programming' started by ac1, Jan 17, 2011.

  1. ac1, Jan 17, 2011
    Last edited: Jan 17, 2011

    ac1
    macrumors newbie

    Joined:
    Jan 17, 2011
    #1
    First post, hi!

    I am looking to create a 'simple' iphone app that shows the location of updates from nearby users. A user can insert an update (along with location, which I can get as a longitude,latitude) and then this is updated to some database online and the latest x updates are downloaded and put on a map as pins (which again I can do using MKAnnotations)... question is how would I upload and download data to the database.

    TIA.
     
  2. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    The simplest answer? Web Services.

    Let us know if you have more specific needs, and we'll see if we can provide you more specific direction.
     
  3. ac1, Jan 19, 2011
    Last edited: Jan 20, 2011

    ac1
    thread starter macrumors newbie

    Joined:
    Jan 17, 2011
    #3
    I've created a mySQL database and the PHP to go with it which allows me to insert data into the table.

    Now, I'm thinking I could just use NSURLRequest to upload "http://site.com/database/upload.php?lat=%@&long=%@&update=%@"

    problem is I can't quite see how exactly I'd get this to work.

    I haven't started thinking about downloading the data back to the app, but I suppose I could write more PHP to help me.

    EDIT: Fixed NSURL Request...

    I'm going to output each row from the table as a JSON object, and then write a for loop over each row to place a pin on the map.
     

Share This Page