We generally deal with different types of applications where there is a usage for inserting data into MySQL database and retrieving it.

It involves a insertion of data, retrieval, updating and some times even deleting all these operations we do in any app for example consider facebook if you make a post it gets inserted there in db, and edit the status it gets updated, and when searching for a friends post it comes under retrieval and finally deleting your post is deleting process.

We never notice all these changes in foreground as they are done in background which the user noway even have an idea.So, today lets go on with this tutorial and see how the server process works out.

So today i want to show you how to insert values into server in this tutorial on Android Insert Details MySQL Database.

 

 

Right from basic level we will see how to make php files and also database.   Lets start it by creating a database in MYSQL

 

 

Now we will see how to code in php to insert details into database but before to that we will connect out code to database with a connector file.   Php folder format AndroidCoding  –>  dbconnect.php, input.php (folder name)                       (php files)

 

dbconnect.php

 

 

Now using this file we will connect our php file.

input.php

 

 

activity_main.xml

Now  we will design a view where user will input details like name, country, email, hobbies.And after entering details a submit button for the form needs to be done.

 

 

So now we have got database, php files for connecting and inserting now we will see java coding.   Now all the details like name, country, email, hobbies into arraylist as below.

 

Creating async class for inserting values into server.

MainActivity.java

This is final full coding for inserting details into mysql database.

 

 

Output :

insert1

 

 

insert2

 

If you have any query comment below and do like and share if you like this tutorial.

Show Buttons
Hide Buttons
Read previous post:
Android Facebook Based Login Tutorial Part – 2

Close