android - how to put data in two different table using two different activity -


here in application in first activity using following code storing data mysql. java code:

public class mainactivity extends activity {  edittext et; button b; inputstream is; @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      et = (edittext) findviewbyid(r.id.edittext1);     b = (button) findviewbyid(r.id.button1);      b.setonclicklistener(new view.onclicklistener() {          @override         public void onclick(view arg0) {             // todo auto-generated method stub              string name = et.gettext().tostring();             arraylist<namevaluepair> params = new arraylist<namevaluepair>();             params.add(new basicnamevaluepair("name", name));               try {                 httpclient httpclient = new defaulthttpclient();                 httppost httppost = new httppost("http://10.0.2.2/insert1.php");                 httppost.setentity(new urlencodedformentity(params));                 httpresponse response = httpclient.execute(httppost);                 httpentity entity = response.getentity();                 = entity.getcontent();                 toast.maketext(getbasecontext(), "congrats! ur added", toast.length_long).show();                  intent mainpage = new intent("com.example.test.place");                 startactivity(mainpage);             } catch (exception e) {                 e.printstacktrace();                 toast.maketext(getbasecontext(), "not connected database", toast.length_long).show();             }          }     });  } 

for make simple have used 1 field here. , tried field user in other activity , tried store in different table using same concept of above code. not getting stored. can me out in issue.. tried long time not working. kindly me. other java code used in other given below.. want need name , place in different activity , want store them in different table. kindly me..

protected void oncreate(bundle savedinstancestate) {     // todo auto-generated method stub     super.oncreate(savedinstancestate);     setcontentview(r.layout.place);      t = (edittext) findviewbyid(r.id.edittext1);      tv = (textview) findviewbyid(r.id.textview1);      view bb = (button) findviewbyid(r.id.button1);     bb.setonclicklistener(this);  }    @override public void onclick(view v) {     // todo auto-generated method stub     string place = t.gettext().tostring();     arraylist<namevaluepair> namevalueparams = new arraylist<namevaluepair>();     namevalueparams.add(new basicnamevaluepair("place", place));       try {         httpclient httpclient = new defaulthttpclient();         httppost httppost = new httppost("http://10.0.2.2/insert11.php");         httppost.setentity(new urlencodedformentity(namevalueparams));         httpresponse response = httpclient.execute(httppost);         httpentity entity = response.getentity();         iss = entity.getcontent();         toast.maketext(getbasecontext(), "congrats! ur added", toast.length_long).show();        } catch (exception e) {         e.printstacktrace();         toast.maketext(getbasecontext(), "not connected database", toast.length_long).show();     } } 

well, calling insert1.php in upper code , insert11.php in code below. if first works , second doesn't there has difference what's inside 2 different phps.

expect different results different code bases :)


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -