0

I need to connect my mobile app to a database so it can send information from the app to the database.

I have looked at a ton of tutorials but they seem to irrelevant to my situation or write the entire application in XML. Can I connect it through script tags in the app or do I need to connect to via PHP and if I do where do I place that file in the application?

halfer
  • 19,824
  • 17
  • 99
  • 186
user3618687
  • 113
  • 1
  • 11
  • Not 100%, but 95% that you cant connect directly to database from any mobile platform (except of course, inapp db, like sqlite), you must use a webservice. You need to put the PHP (or the language you want) in a server, and connect via webservice with that script. – Vertig0 May 26 '14 at 20:04
  • 1
    In which database you want to store your data, in android system database called 'SQLite' or in any MySQL database on remote server? – Vikas Sharma May 26 '14 at 20:06
  • Vikas - I am currently using PHPMyAdmin – user3618687 May 26 '14 at 20:15
  • Vertig0 - How exactly does it connect to the mobile app if the php script is only in the server. I have a script ready to go from tutorials I was trying to follow but I can't see how it would connect. – user3618687 May 26 '14 at 20:21

2 Answers2

0

It is not clear to me if it is a local database on your phone or not.

If it is a local database on your phone I would use android's api.

If it is not, the best option is to write a SOAP or Rest service which need to run on a server. Personally I would go for a REST service, because it is less complicated. Although if there is sensitive data it might be better to use a SOAP service. You might take a look at this.

For calling your Rest services you could use a httpwebrequest. I belief this is an good example.

Community
  • 1
  • 1
Robin Dijkhof
  • 18,665
  • 11
  • 65
  • 116
0

Write ur database related code in php and from your app send the post or get parametized url so it can be stored to ur phpmyadmin db

Yogesh Lakhotia
  • 888
  • 1
  • 13
  • 26
  • I'm assuming to send the jQuery information I would need to store that information in a php variable and from there send it to the storage location in the database. Is that correct? – user3618687 May 26 '14 at 20:35
  • use volley library to send ur data to server and do what ever you want with data... check volley library in android – Hossein Mansouri May 06 '16 at 20:35