Android PHP MYSQL Database Example

By | January 6, 2016

This tutorial teaches you how to integrate PHP and MYSQL with your android application. This is very useful in case you have a webserver, and you want to access its data on your android application.

MYSQL is used as a database at the webserver and
PHP is a Scripting Language which we use to fetch data from the database into JSON format .

We will create a server side script using PHP which will get data from a MySQL database into JSON format. After that, we consume the JSON data into the Android client application. This is how we can connect Android with PHP and MySQL.

Setting-Up  Server

You need a Hosting Server account or you can also use your local wamp server (Install WAMP, XAMPP into your PC) .

I am using 000webhost.com as my hosting server , where i will setup mysql database and also place php scripts .

  • Firstly Sign into 000webhost.com .
  • Request for free hosting account with a free sub-domain .

After logging into your account successfully just follow below steps to set up .

Setting Up MySQL Database 

 

 

 

 


Placing PHP Scripts 

Below Screen Shows how and where to place the php scripts

 

 

Android PHP CRUD Operation

Android PHP tutorial is divided into 4 parts .

  1.  Inserting Into MYSQL Database.
  2.  Reading From MYSQL Database.
  3. Updating Into MYSQL Database.
  4.  Deleting From MYSQL Database.

Demo Video of Final Output

.