Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to extract json data and insert in mysql php
    primarykey
    data
    text
    <p>Actually I am new to android web services so please help me my problem I am sending json encoded data from mobile client and I am getting json data on server side so that client side code:</p> <pre><code> mJobject.put("userName", contactname.getText().toString()); mJobject.put("phonenumber",phonenumber.getText().toString() ); mJArray.put(mJobject); Log.v(Tag, "^============send request" + mJArray.toString()); contactparams.add(new BasicNameValuePair("contactdetails", mJArray.toString())); Log.v(Tag, "^============send request params" + mJArray.toString()); jsonString=WebAPIRequest.postJsonData("http://localhost/contactupload/contactindex.php",contactparams); public static String postJsonData(String url, List&lt;NameValuePair&gt; params) { String response_string = new String(); HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(url); // httppost.addHeader("Content-Type", "application/x-www-form-urlencoded"); try { httppost.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); /* String paramString = URLEncodedUtils.format(params, HTTP.UTF_8); String sampleurl = url + "" + paramString; Log.e("Request_Url", "" + sampleurl);*/ // Execute HTTP Post Request HttpResponse response = httpclient.execute(httppost); if (response != null) { InputStream in = response.getEntity().getContent(); response_string = WebAPIRequest.convertStreamToString(in); } } catch (Exception e) { e.printStackTrace(); } return response_string; </code></pre> <p>and php side I am doing</p> <pre><code>&lt;?php $json_data=$_POST['contactdetails']; $data=json_decode($json_data); print_r($data); ?&gt; </code></pre> <p>I am getting response </p> <pre><code> Array ( [0] =&gt; stdClass Object ( [phone number] =&gt; 5555 [username] =&gt; xfg ) ) </code></pre> <p>so how can I extract json data in php and insert in mysql</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload