1

データベースのフィールドを更新しようとしていますが、php ページから未定義の変数エラーが発生しています...

私のコードは次のとおりです。

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();

                }
        }
    });

そして、私のphpコードは次のとおりです。

 <?php 
// Connects to your 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 now it works..";
$order="Update meetingdetails SET status='$res' WHERE status IS NULL AND title='$title' AND mdate='$new_date' AND mtime='$new_time' AND attendees='$attend' AND venue='$venue'";
$result=mysql_query($order,$con);
//echo "It still works";
if($result==1)
{
echo "true";
}
else{
echo "false".mysql_error();
}
mysql_close($con);
?>

データベースのステータスフィールドを更新したいのですが、それを行うことができません..表示されるエラーは次のようになります

ここに画像の説明を入力

アプリケーションを正しく実行できるように、何か提案してください...事前にThnx

4

1 に答える 1