Native app for iPhone with php / MySQL

Discussion in 'iPhone' started by Dubya1964, Oct 20, 2008.

  1. Dubya1964 macrumors newbie

    Oct 20, 2008
    Hi there,

    I'm completely new to the Mac-environment so bare with me if I seem to be asking stupid questions...

    I'm thinking about making A NATIVE APP for the iPhone (meaning: something users can buy in the Applestore and use on their iPhone) with the SDK.

    This app should:
    - let users login with a username and password to a online database which is stored on a webserver
    - retrieve data from this online database and display it on their iPhone
    - manipulate/alter the retrieved data on the iPhone
    - send the manipulated/altered data back to the database for storage.
    - logoff users from the database

    And all of the above should be done by the use of PHP/MySQL.
    For the sake of clarity: the database IS NOT LOCATED in/on the iPhone (I've seen tutorials with databases and SQLite but -unless I'm totally wrong- these DB's seem to be stored on the iPhone).

    So, any wise thougts from you guys: can such an app be built with the SDK?

    Love to hear from you.

    Thanks & cheers,


    ps: and uhm... can people with hacked iPhones buy apps from the webstore? Just to give you an idea: estimates say that there are about 15.000 hacked iPHones in use in Belgium vs. 4000 official iPhones (sold on first day of the launch, stocks are now on 0)
  2. robbieduncan Moderator emeritus


    Jul 24, 2002
    SDK based native apps that get installed on the phone can only be written with Objective-C. No other languages, including PHP, can be used.
  3. DrummerB macrumors member

    Mar 5, 2008
    You'll have to write your native app in Objective-C. But you can connect to a MySQL DB on your webserver using PHP.
  4. Dubya1964 thread starter macrumors newbie

    Oct 20, 2008
    Ok, now I'm really puzzled!

    First of all: thanks to DrummerB and robbieduncan for taking the time to answer my questions.

    But (yep, there's always a but) now I've got 2 opposite opinions on my lap.

    Both of you agree that, to make native apps, I'll have to work with Objective-C. No problem there: I'll be using the iPhone SDK from Apple and that has all I need to work in Obj-C.

    But robbieduncan says: "No other languages, including PHP, can be used"
    While DrummerB states: "But you can connect to a MySQL DB on your webserver using PHP"

    So, what shall it be then?
    If I follow robbieduncan, my problem is solved (well sort of: I just won't be able to make the app I have in mind)
    If I follow DrummerB, my question is: where can I find more info/tutorials to work with php on iPhone...

    Thanks again for your contributions.

  5. robbieduncan Moderator emeritus


    Jul 24, 2002
    I'm pretty sure we both meant the same thing. I believe DrummerB was meaning you can write the server side part of your app that does not run on the iPhone in PHP. You cannot run any PHP code on the iPhone so there are no tutorials on this.
  6. t4cgirl macrumors member

    Feb 22, 2008
    Come on now, this is a problem that's already been solved.

    Install phpMyAdmin on your server, and use Safari. It works great.

    So your task would be to create a native interface that will be clearer, more robust, faster, and more stable that phpMyAdmin in a Safari window... and you're not sure how PHP works with the iPhone SDK. Fair enough, you gotta start somewhere, but as an expert in both I'd suggest you start with something a bit less ambitious and more *fun*.
  7. firewood macrumors 604

    Jul 29, 2003
    Silicon Valley
    The key words are "on your webserver".

    You can't run PHP on your iPhone.

    You can run PHP on your webserver (which is not on your iPhone), and communicate with that webserver from an Objective C app (or web app) on your iPhone.

  8. DrummerB macrumors member

    Mar 5, 2008
    Yes. You can only write native apps in Obj-C (at least if you want it to release in the AppStore). In that app you would send requests to some php sites you created to access and/or modify your database. This is how I'm doing it. I don't know if there are any better solutions. We could share our experiences if you'd like, since I'm working on an app that has to access an external MySQL database.
  9. CocoaPuffs macrumors 68010

    Aug 23, 2008
    Why make things harder?

    Forget native app, just make a simple iPhone compatible website.

    Or else learn Cocoa and Objective-C (which isn't so hard if you have experience with C and other objective language like Java).
  10. Dubya1964 thread starter macrumors newbie

    Oct 20, 2008
    Invitation to drummerB: please contact me at

    A direct line will make it easier to communicate I guess.

    And maybe I didn't paint a clear picture: what I wanted to know was whether you can make a native app (written in Obj-C) that lets you connect with an online database and allows you to retrieve/manipulate data and send these data back.

    In other words: use the iPhone as a window through which you can view the data.

    Thanks for all your contributions.


Share This Page