이것은 xamp server.Here를 사용하여 android-php-mysql 연결을 기반으로하는 간단한 프로젝트이며, 서버 데이터베이스에서 성공적으로 업데이트하고 쿼리를 업데이트하려고합니다. 내 프로그램의 상태가 작동하지 않는다면, 나는 무엇을 할 것인가 ?? 제발 도와주세요. 여기 제 코드가 있습니다 !! 는내부 조건이 프로그램 내부에서 작동하지 않는 경우
btt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try{
httpclient=new DefaultHttpClient();
httppost= new HttpPost("http://192.168.0.45/doctorphp/status.php"); // make sure the url is correct.
//add your data
nameValuePairs = new ArrayList<NameValuePair>(1);
// Always use the same variable name for posting i.e the android side variable name and php side variable name should be similar,
nameValuePairs.add(new BasicNameValuePair("date",Datetxt.getText().toString().trim())); // $Edittext_value = $_POST['Edittext_value'];
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
ResponseHandler<String> responseHandler = new BasicResponseHandler();
final String response = httpclient.execute(httppost, responseHandler);
System.out.println("Response : " + response);
runOnUiThread(new Runnable() {
public void run() {
tvView.setText("Response from PHP : " + response);
} });
if(response.equalsIgnoreCase("Granted")){
runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(UserPage.this,"Granted successfully", Toast.LENGTH_SHORT).show();
}
});
Intent intent=new Intent(UserPage.this, token.class);
startActivity(intent);
}
else{
showAlert();
}
}
catch(Exception e){
System.out.println("Exception : " + e.getMessage());
Toast.makeText(getApplicationContext(),"Error:"+e.toString(), Toast.LENGTH_LONG).show();
}
}
});
디버깅 해 본 적이 있습니까? –
'응답'에 뭐가 들었습니까 ?? –