如何从android studio接收Php中的Json数组并将其保存在mysql中

I would like to like to receive the JSON array and save it to an SQLite database? The steps I have taken are as follows:

  • I have created an SQLite database in Android Studio.
  • I converted the SQLite database into a JSON array, when a button is clicked
  • Through a Http request the array is sent

There are four columns.

try {

                // 1. create HttpClient
                HttpClient httpclient = new DefaultHttpClient();

                // 2. make POST request to the given URL
                HttpPost httpPost = new HttpPost( "http://192.168.1.7/sql.php");

//TotalRecord=jsonarray.toString();

                StringEntity se = new StringEntity(TotalRecord);
                abc=true;

                // 6. set httpPost Entity
                httpPost.setEntity(se);

With those columns I would like to recieve the data inside them into the JSON array, Any way of achieving this in PHP?

Post Structure is :

            Cursor res = myDB.getAllData();
            if (res.getCount() == 0) {
                showMessage("error", "nothing to disply");
                return;
            }
            JSONArray jsonArray = new JSONArray();
            //JSONObject jsonObject=new JSONObject();
            StringBuffer stringBuffer = new StringBuffer();
      while (res.moveToNext()) {// Converted whole sqlite database in Json
                JSONObject jsonObject = new JSONObject();
                String id = "";
                String name = "";
                String surname = "";
                String marks = "";
                id = String.valueOf(stringBuffer.append(res.getString(0)));
                name = String.valueOf(stringBuffer.append(res.getString(1)));
                surname = String.valueOf(stringBuffer.append(res.getString(0)));
                marks = String.valueOf(stringBuffer.append(res.getString(0)));
                try {
                    jsonObject.accumulate("ID", id);
                    jsonObject.accumulate("Name", name);
                    jsonObject.accumulate("SurName", surname);
                    jsonObject.accumulate("Marks", marks);
                    jsonArray.put(jsonObject);

                } catch (JSONException e) {
                    e.printStackTrace();
                }
                TotalRecord = jsonArray.toString();