首页 > 代码库 > How does Android, PHP, SQL, JSON, and Remote Databases work together?

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

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:

Android Remote Database Example

 

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