码迷,mamicode.com
首页 > 移动开发 > 详细

How does Android, PHP, SQL, JSON, and Remote Databases work together?

时间:2014-09-23 17:57:24      阅读:207      评论:0      收藏:0      [点我收藏+]

标签:des   android   http   io   ar   for   sp   art   on   

http://www.mybringback.com/tutorial-series/12924/android-tutorial-using-remote-databases-php-and-mysql-part-1/

As I’ve mentioned, our Android app and a remote MySQL database can’t communicate with each other directly without it being an incredibly tedious process. It would be like a Chinese person trying to talk to someone from Iceland. We don’t want to play charades if we don’t have to, so instead, we will get an interpreter. This interpreter will be PHP. PHP will do all of the talking for us. For example, if we want to create a new user for our application from our Android device, we will want our application to have some input fields, such as username, password, favorite kind of cheese, etc. When the user fills out this information and hits submit, we will pass the information to our PHP web service. The web service will connect to the MySQL Database, and find the “Users” table and insert a new row into the MySQL database with the information that was sent from our Android device. Once our row is created, we will have our webservice display some JSON data that will tell us whether we entered the data successfully or not. Lastly, our Android device will parse this JSON data and display a “Success” message, or a “Failure, please try again” message.

The process in visual form would look like this:

bubuko.com,布布扣

 

How does Android, PHP, SQL, JSON, and Remote Databases work together?

标签:des   android   http   io   ar   for   sp   art   on   

原文地址:http://www.cnblogs.com/wingjay/p/3988659.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!