Undefined variable error in php while updating value from android -
i trying update field in database getting undefined variable error php page...
my code is:
intent myintent = getintent(); //mdate = intent.getstringextra("mdate"); //toast.maketext(getapplicationcontext(), mdate.tostring(), toast.length_long).show(); title=(edittext)findviewbyid(r.id.edittext1); bundle extras = getintent().getextras(); if(extras != null){ mtitle = extras.getstring("title"); stime = extras.getstring("mtime"); sdate = extras.getstring("mdate"); cvenue = extras.getstring("venue"); } title.settext(mtitle); title.setfocusable(false); cdate=(edittext)findviewbyid(r.id.edittext2); cdate.settext(sdate); cdate.setfocusable(false); venue=(edittext)findviewbyid(r.id.edittext4); venue.settext(cvenue); venue.setfocusable(false); ctime=(edittext)findviewbyid(r.id.edittext3); ctime.settext(stime); ctime.setfocusable(false); fdate=cdate.gettext().tostring(); ftime=ctime.gettext().tostring(); ftitle=title.gettext().tostring(); fvenue=venue.gettext().tostring(); fattend=uid.tostring(); cnfrm=(button)findviewbyid(r.id.button1); cnfrm.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub try { string str_params=urlencoder.encode("res="+resy.tostring()+ "&title="+ftitle+ "&venue="+fvenue+ "&cdate="+fdate+ "&ctime="+ftime+ "&attend="+fattend,"utf-8"); get= new httpget("http://10.0.2.2/meetingschedular/confirmmeet.php?"+str_params); client= new defaulthttpclient(); res=client.execute(get); in=res.getentity().getcontent(); stringbuffer str= new stringbuffer(); int ch; while((ch=in.read())!=-1) { str.append((char)ch); } string tmp=str.tostring(); tmp=tmp.trim(); //txt.settext(tmp); toast.maketext(getapplicationcontext(), tmp, toast.length_long).show(); if(flag.equals(tmp)) { toast.maketext(getapplicationcontext(), tmp, toast.length_long).show(); } else { toast.maketext(getapplicationcontext(), "sorry cannot confirm", toast.length_long).show(); } } catch(exception e) { toast.maketext(getapplicationcontext(), e.tostring(), toast.length_long).show(); } } });
and php code :
<?php // connects database $con=mysql_connect('localhost','root',''); mysql_select_db('meetingschedulardata',$con); if(!$con) { die("can not connect".mysql_error()); } if (isset($_get['title'])) { $title=$_get['title']; } if(isset($_get['cdate'])) { $cdate=$_get['cdate']; } if(isset($_get['ctime'])) { $ctime=$_get['ctime']; } if(isset($_get['attend'])) { $attend=$_get['attend']; } if(isset($_get['venue'])) { $venue=$_get['venue']; } if(isset($_get['res'])) { $res=$_get['res']; } $sdate = strtotime($cdate); $new_date = date('y-m-d', $sdate); $stime = strtotime($ctime); $new_time = date('h:i:s', $stime); //echo "till works.."; $order="update meetingdetails set status='$res' status null , title='$title' , mdate='$new_date' , mtime='$new_time' , attendees='$attend' , venue='$venue'"; $result=mysql_query($order,$con); //echo "it still works"; if($result==1) { echo "true"; } else{ echo "false".mysql_error(); } mysql_close($con); ?>
i want update status field in db unable that.. error showing this
pls suggest me thing can run application correctly... thnx in advance
check variables passing android , using @ sever side in php code. check php side print_r($_request); exit; @ start of page. debug , can variables list passing android.
if fine , same variable getting no problem @ sever side.
thanks :) kuldip
Comments
Post a Comment