php - inserting into database using post method in android -


i have register form in android application. want need insert registration information web database after registration can login verifying database stored.

my onpostexecute method

@override         protected void onpostexecute(string result) {             super.onpostexecute(result);              if(result.equals("working")){                 toast.maketext(getapplicationcontext(), "http post working...", toast.length_long).show();             }else{                 toast.maketext(getapplicationcontext(), "invalid post req...", toast.length_long).show();             }         }    

and php code is

$varusername = $_post['paramusername']; $varpassword = $_post['parampassword'];  if (isset($_post['tag']) && $_post['tag'] != '')   {      $con= mysql_connect('localhost', 'root', '');      if (!$con) {     die('not connected : ' . mysql_error());                     }        // make foo current db      $db_selected = mysql_select_db('post_db', $con);        if (!$db_selected) {   die ('can\'t use foo : ' . mysql_error());}        $sql="insert post_table (username,password)        values('$varusername ','$varpassword')";         if (!mysqli_query($con,$sql)){ die('error: ' . mysqli_error($con)); }  echo 'working';       }             else{                 echo 'invalid';                        } 

but information can't inserted. show toast of " invalid post req..."; should insert registration information web database?? , after should procedure login???


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -