Входные данные от android к базе данных в mysql

У меня есть этот код:

<?php include('konek.php'); $entid=$_POST['entId']; $entSender=$_POST['entSender']; $entTitle=$_POST['entTitle']; $entDate=$_POST['entDate']; $entSAGrade=$_POST['entSAGrade']; $entReason=$_POST['entReason']; $entProblem=$_POST['entProblem']; $entTime=$_POST['entTime']; if($row_num != 0) { $ins=mysql_query("INSERT into tblentry(entId,entSender,entTitle,entTime,entSAGrade,entReason,entProblem) VALUES('$entId','$entSender','$entTitle',CURTIME(),'$entSAGrade','$entReason','$‌​entProblem')"); echo "Added"; } else { echo "Added."; } ?> 

Моя проблема заключается в том, что когда я ввожу данные в свой симулятор Android, он не добавляется. В чем проблема в моем коде?

И вот мой код в андроиде:

 public class AddEntry extends Activity { Button buttonSave; EditText ent1, ent2, ent3, ent4, ent5, ent6 ; HttpPost httppost; HttpResponse response; HttpClient httpclient; List<NameValuePair> nameValuePairs; ProgressDialog dialog = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.addentry); buttonSave = (Button)findViewById(R.id.Save); ent1 = (EditText)findViewById(R.id.entSender); ent2 = (EditText)findViewById(R.id.entDate); ent3 = (EditText)findViewById(R.id.entTitle); ent4 = (EditText)findViewById(R.id.entSAGrade); ent5 = (EditText)findViewById(R.id.entReason); ent6 = (EditText)findViewById(R.id.entProblem); buttonSave.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog = ProgressDialog.show(AddEntry.this, "", "Adding entry. . .", true); new Thread(new Runnable() { public void run() { insertEntry(); } }).start(); } }); } void insertEntry(){ try{ httpclient=new DefaultHttpClient(); httppost= new HttpPost("http://10.0.2.2/smcfi/insertentry.php"); // make sure the url is correct. //add your data nameValuePairs = new ArrayList<NameValuePair>(6); // Always use the same variable name for posting ie the android side variable name and php side variable name should be similar, nameValuePairs.add(new BasicNameValuePair("enSender",ent1.getText().toString().trim())); // $Edittext_value = $_POST['Edittext_value']; nameValuePairs.add(new BasicNameValuePair("entDate",ent2.getText().toString().trim())); nameValuePairs.add(new BasicNameValuePair("entTitle",ent3.getText().toString().trim())); nameValuePairs.add(new BasicNameValuePair("entSAGrade",ent4.getText().toString().trim())); nameValuePairs.add(new BasicNameValuePair("entReason",ent5.getText().toString().trim())); nameValuePairs.add(new BasicNameValuePair("entProblem",ent6.getText().toString().trim())); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); //Execute HTTP Post Request response=httpclient.execute(httppost); // edited by James from coderzheaven.. <span id="IL_AD10" class="IL_AD">from here</span>.... ResponseHandler<String> responseHandler = new BasicResponseHandler(); final String response = httpclient.execute(httppost, responseHandler); System.out.println("Response : " + response); runOnUiThread(new Runnable() { public void run() { // tv.setText("Response from PHP : " + response); dialog.dismiss(); } }); if(response.equalsIgnoreCase("Added")){ runOnUiThread(new Runnable() { public void run() { Toast.makeText(AddEntry.this,"Successfully Added.", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(AddEntry.this, Entry.class); AddEntry.this.startActivity(intent); AddEntry.this.finish(); } }); }else{ showAlert(); } }catch(Exception e){ dialog.dismiss(); System.out.println("Exception : " + e.getMessage()); } } public void showAlert(){ AddEntry.this.runOnUiThread(new Runnable() { public void run() { AlertDialog.Builder builder = new AlertDialog.Builder(AddEntry.this); builder.setTitle("Error"); builder.setMessage("Not Added.") .setCancelable(false) .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); AlertDialog alert = builder.create(); alert.show(); } }); } @Override public void onBackPressed() { Intent intent = new Intent(AddEntry.this, MainAct.class); AddEntry.this.startActivity(intent); AddEntry.this.finish(); } 

}

Я не знаю, в чем ошибка. но это не добавление. мои введенные данные не добавляются в мою базу данных.

Solutions Collecting From Web of "Входные данные от android к базе данных в mysql"