run time error at the time of username and password validation i give the all details
<pre><code>&lt;?php
$con=mysql_connect("localhost","root","");
if (!$con)
{
    die('Could not connect: ' . mysql_error());
}
mysql_select_db("traccia");
$username=$_POST['username'];
$password=$_POST['password'];
$username = stripslashes($username);
$password = stripslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
$result = mysql_query("SELECT username FROM login WHERE username = '$username' AND password =('$password')", $con); 
if(mysql_num_rows($result))
{
        echo "Y";
}
else
{
        echo "N";
}
mysql_close();
</code></pre>

<p>?>
    android code:</p>

<pre><code>public class Traccia1Activity extends Activity {
/** Called when the activity is first created. */
InputStream is=null;
EditText username,password;
Button login,cancel;
String result="";
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    username=(EditText)findViewById(R.id.unm);
    password=(EditText)findViewById(R.id.pwd);
    login=(Button)findViewById(R.id.login);
    cancel=(Button)findViewById(R.id.clear);
    login.setOnClickListener(new OnClickListener(){

        public void onClick(View v) {
            // TODO Auto-generated method stub
            ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;();
            nameValuePairs.add(new BasicNameValuePair("username",username.getText().toString()));
            nameValuePairs.add(new BasicNameValuePair("password",password.getText().toString()));  
            try{
                    HttpClient httpclient = new DefaultHttpClient();
                    HttpPost httppost = new HttpPost("http://10.0.2.2:80/login.php");
                    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                    HttpResponse response = httpclient.execute(httppost); 
                    HttpEntity entity = response.getEntity();
                     is = entity.getContent();
                     System.out.println("connect1");
            }catch(Exception e){
                    Log.e("log_tag", "Error in http connection "+e.toString());
            }
            //convert response to string
            try{
                    BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8);
                    StringBuilder sb = new StringBuilder();
                    String line = null;
                    while ((line = reader.readLine()) != null) {
                            sb.append(line + "\n");
                    }
                    is.close();
                     result=sb.toString();
                     System.out.println(result);
                   }catch(Exception e){
                    Log.e("log_tag", "Error converting result "+e.toString());
                   }
            if(result.equals("Y"))
                System.out.println("ok");
            else
                System.out.println("cancel");

        }
    });
    cancel.setOnClickListener(new OnClickListener(){

        public void onClick(View v) {
            // TODO Auto-generated method stub
            username.setText("");
            password.setText("");
        }
    });

    }
</code></pre>
