I am verifying a user (email address and password) in database and and echo the result.
if($num_rows == 1)
{
$usertypeid = mysql_fetch_array($query_result);
echo $usertypeid[0];
}
else
{
echo "invalid_user";
}
When i test it on a normal browser it prints exactly what i want. When I do http request from android, it returns the string correct. But it has something garbage value at first byte I guess which is not visible though.
HttpResponse httpResponse = httpClient.execute(httpGet);
HttpEntity httpEntity = httpResponse.getEntity();
strResult = EntityUtils.toString(httpEntity);
Then I am comparing strResult with a final string and check if it is not a failure.
if (!strResult.equals(Konstant.HTTP_RESULT_SIGNIN_FAILURE))
So, when strResult is actually "invalid_user" the condition should not pass. But it passes.
If i use "endsWith()" instead of "equals()", it works fine. or If i use substring() to eliminate first byte and then use equals, it works fine.
Can anyone please help me what's happening here?