I want to send data from my Android application to a MySQL database.
The PHP script I am using is working, as when I used it on a browser,
the information is entered into the database.

The database is not being updated and no error is thrown.

Any ideas?

Here is my Android code:

public class SendData extends Activity{

    @Override
    public void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.prayers);

        final MediaPlayer mpButtonClick =
MediaPlayer.create(this,R.raw.button);
        Button bsendp = (Button) findViewById(R.id.buttonprayer);
        bsendp.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                try {
                    HttpClient httpclient = new DefaultHttpClient();
                    HttpPost httppost =
                        new HttpPost("http://www.xxxx.com/
android.php");
                    //httppost.setEntity(
                    //    new UrlEncodedFormEntity(nameValuePairs));
                    HttpResponse response =
httpclient.execute(httppost);
                } catch (Exception e) {
                    Log.e("log_tag", "Error in http connection
"+e.toString());
                }
                // TODO Auto-generated method stub
                startActivity(
                    new
Intent("com.android.testproject.InsertComplete"));
                mpButtonClick.start();
            }
        });
    }
}

Thanks in advance.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to