Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
LinkBack Thread Tools Display Modes
Old 02-26-2011, 12:47 AM   #1 (permalink)
Registered Member
 
Join Date: Feb 2011
Posts: 7
chuntakli2 is on a distinguished road
Unhappy [HELP!!!] Newbie for app develop... (a bit long post)

hi all, I am a newbie for iPhone app develop and now I have to create an iPhone app for my project which about in-house restaurant ordering system.
For my project, I had set up a local server (Linux + apache + phpMyAdmin + MySQL) to handle the database data and for the iPhone app, it should be used to get the data from the database and add data to the database.
p.s: My server and iPhone are placed in the same network for communication and linked up with a router.

At this moment, I have created the interface for my iPhone app only. The first page is for waiter to enter the customer number and table number for further functions, then it will push to the main page with several tabs below for different pages like menu(for placing the order from the customer) and orderList(according to customer no. to the corresponding order list).

My questions are how can my iPhone app connect to my local server, especially the database?
Is it possible to use PHP script to communicate with the server to get/modify the database data from my app and return the data by XML to my app (if possible, how can I do so)?
Is my approach for this app develop correct? (iPhone app -> local web server -> database)
As I have mentioned above, the first page is prompt waiter to enter customer's info, can I use that info to get the data from the database and how? (customer number is unique in the database).
Finally, I had googled for long time but I cant get examples for teaching me how to deal with my problem, I hope u guys can post me some source codes for reference.

Sorry for my poor presentation. Hope you guys can understand my problem and help me.
Thanks so much
chuntakli2 is offline   Reply With Quote
Old 02-26-2011, 04:15 AM   #2 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 97
hodgey87 is on a distinguished road
Default

Quote:
Originally Posted by chuntakli2 View Post
hi all, I am a newbie for iPhone app develop and now I have to create an iPhone app for my project which about in-house restaurant ordering system.
For my project, I had set up a local server (Linux + apache + phpMyAdmin + MySQL) to handle the database data and for the iPhone app, it should be used to get the data from the database and add data to the database.
p.s: My server and iPhone are placed in the same network for communication and linked up with a router.

At this moment, I have created the interface for my iPhone app only. The first page is for waiter to enter the customer number and table number for further functions, then it will push to the main page with several tabs below for different pages like menu(for placing the order from the customer) and orderList(according to customer no. to the corresponding order list).

My questions are how can my iPhone app connect to my local server, especially the database?
Is it possible to use PHP script to communicate with the server to get/modify the database data from my app and return the data by XML to my app (if possible, how can I do so)?
Is my approach for this app develop correct? (iPhone app -> local web server -> database)
As I have mentioned above, the first page is prompt waiter to enter customer's info, can I use that info to get the data from the database and how? (customer number is unique in the database).
Finally, I had googled for long time but I cant get examples for teaching me how to deal with my problem, I hope u guys can post me some source codes for reference.

Sorry for my poor presentation. Hope you guys can understand my problem and help me.
Thanks so much

Have a look at this thread theres a tutorial about interacting with databases:

Sqlite tutorial

Might be of some use.
hodgey87 is offline   Reply With Quote
Old 02-26-2011, 04:23 AM   #3 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

the linked that posted hodgey87 is not usefull for you.

yes, you can create php methods to do operations in your mysql DB, and you can call these with ASIHTTPRequest or NSURLConnection, you can use POST to add an xml as input.

Maybe you can choose to go making a WebService, but if you are not familiar with that, it's not the best choice.
__________________
dany_dev is offline   Reply With Quote
Old 02-26-2011, 04:35 AM   #4 (permalink)
Registered Member
 
Join Date: Feb 2011
Posts: 7
chuntakli2 is on a distinguished road
Default

Quote:
Originally Posted by dany88 View Post
the linked that posted hodgey87 is not usefull for you.

yes, you can create php methods to do operations in your mysql DB, and you can call these with ASIHTTPRequest or NSURLConnection, you can use POST to add an xml as input.

Maybe you can choose to go making a WebService, but if you are not familiar with that, it's not the best choice.
Yes, I might choose web service for working on my app, but can you give me some ways to follow? what I have to do for both server and iphone side? Thx so much
chuntakli2 is offline   Reply With Quote
Old 02-26-2011, 04:41 AM   #5 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

when you want to read something, call a specific php script:

iphone-->php script--DB-->xml--->iphone

and parse with NSXMLParser the xml returned.

when you want to change something in your DB, based on input on your iphone

iphone, create an xml (or something other)--->send in POST to php script---DB--->return "ok" to iphone

to communicate with the script from the iphone (as I already said) use ASIHTTPRequest or NSURLConnection
__________________
dany_dev is offline   Reply With Quote
Old 02-26-2011, 06:24 AM   #6 (permalink)
Indie Developer
 
iSDK's Avatar
 
Join Date: Jul 2010
Posts: 1,346
iSDK is on a distinguished road
Send a message via AIM to iSDK
Default

Danny is correct. This is the way forward. I am currently doing exactly the same as what you want, but I am doing it for my in app analytics.

I am not sure that ASIHTTPRequest is the best way, but it is definitely an option.

To add data to a database, it would look somewhat like this:

iphone --> php script --> database --> same php script (with echoed result) --> iphone (result received, if an error alert the user).

Quote:
Originally Posted by dany88 View Post
when you want to read something, call a specific php script:

iphone-->php script--DB-->xml--->iphone

and parse with NSXMLParser the xml returned.

when you want to change something in your DB, based on input on your iphone

iphone, create an xml (or something other)--->send in POST to php script---DB--->return "ok" to iphone

to communicate with the script from the iphone (as I already said) use ASIHTTPRequest or NSURLConnection
iSDK is offline   Reply With Quote
Old 02-26-2011, 07:04 AM   #7 (permalink)
Registered Member
 
Join Date: Feb 2011
Posts: 7
chuntakli2 is on a distinguished road
Default

Quote:
Originally Posted by dany88 View Post
when you want to read something, call a specific php script:

iphone-->php script--DB-->xml--->iphone

and parse with NSXMLParser the xml returned.

when you want to change something in your DB, based on input on your iphone

iphone, create an xml (or something other)--->send in POST to php script---DB--->return "ok" to iphone

to communicate with the script from the iphone (as I already said) use ASIHTTPRequest or NSURLConnection
I have a stupid question, what url should I placed in the URLConnection? my server ip? or other link? or do i need to write a php page link to my db and my url is that php page?
thx again

Last edited by chuntakli2; 02-26-2011 at 07:13 AM.
chuntakli2 is offline   Reply With Quote
Old 02-26-2011, 10:51 AM   #8 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

Quote:
Originally Posted by iSDK View Post
Danny is correct.
dany

however you haven't added more than i said

Yes chuntakli2, of course you need to use the link to your php script
__________________
dany_dev is offline   Reply With Quote
Old 02-26-2011, 01:43 PM   #9 (permalink)
Registered Member
 
TheFlyingDutchman's Avatar
 
Join Date: Feb 2011
Location: NYC
Posts: 81
TheFlyingDutchman is on a distinguished road
Default

Yeah, I'm new to coding in iPhone SDK. But, I want to be able to add a simple textfile to a webserver. I like Flurry for analytics.7
TheFlyingDutchman is offline   Reply With Quote
Old 02-26-2011, 02:06 PM   #10 (permalink)
Indie Developer
 
iSDK's Avatar
 
Join Date: Jul 2010
Posts: 1,346
iSDK is on a distinguished road
Send a message via AIM to iSDK
Default

You have a previous thread on this, where I helped you debug it. You should bump that thread if you still haven't got it working, and say what the problem is rather than interrupting other peoples threads.

Quote:
Originally Posted by TheFlyingDutchman View Post
Yeah, I'm new to coding in iPhone SDK. But, I want to be able to add a simple textfile to a webserver. I like Flurry for analytics.7
iSDK is offline   Reply With Quote
Old 02-27-2011, 09:07 PM   #11 (permalink)
Registered Member
 
Join Date: Feb 2011
Posts: 7
chuntakli2 is on a distinguished road
Default

Quote:
Originally Posted by dany88 View Post
dany

however you haven't added more than i said

Yes chuntakli2, of course you need to use the link to your php script
I still hv some questions about web service, wht I hv to do in the server side (LAMP setting with phpMyAdmin), do i need to create a php file in my server that is linking to the database? if yes, how to?
then for the iPhone app side, the NSURLConnection should be placed at delegate file or the viewcontroller file?

thx a lot again...
chuntakli2 is offline   Reply With Quote
Unread 05-25-2012, 08:01 PM   #12 (permalink)
New User
 
Join Date: May 2012
Posts: 1
garticle is an unknown quantity at this point
Default

Quote:
Originally Posted by chuntakli2 View Post
I still hv some questions about web service, wht I hv to do in the server side (LAMP setting with phpMyAdmin), do i need to create a php file in my server that is linking to the database? if yes, how to?
then for the iPhone app side, the NSURLConnection should be placed at delegate file or the viewcontroller file?

thx a lot again...
I am trying to do similar thing for my app, i have to connect my app to local server and interact with it. Can you please give me sample code of your application?
garticle is offline   Reply With Quote
Reply

Bookmarks

Tags
database, mysql, php, web server, xml

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 368
18 members and 350 guests
Absentia, akphyo, apatsufas, BinHex, cpsclicker, dre, Error404, Gaz, gmarro, jeroenkeij, Kirkout, MarkC, mottdog, Music Man, PavelMik, teebee74, whitey99, Wikiboo
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,666
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, cpsclicker
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:16 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0