title: Who to inserting data into mysql database using the localhost phpmyadmin?
body: <p>I am trying to insert a row into my msql database through wamp server. The database is on the localhost.</p>
  
  <p>I am using android stuido as the ide and don't get any errors or warnings in the log. I couldn't find what's wrong with my code. I'm guessing that the problem is whether with httpclient or php files because new username and password is successfully passed on to <code>NewProductActivty.java</code>. How to fix this issue?</p>
  
  <p>Here is my java and php code:</p>
  
  <p><code>functions.php</code>:</p>
  
  <pre><code>&lt;?php
  $DB_HOST = "localhost";
  $DB_DATABASENAME = "kimnerede";
  $DB_USERNAME = "root";
  $DB_PASS = "";
  define("BASARISIZ", "-1");
  define("BASARILI", "1");
  define("ARKADAS_BULUNAMADI_ERROR", "-2");
  define("ARKADAS_ZATEN_MEVCUT_ERROR", "-3");
  define("PROFIL_BULUNAMADI_ERROR", "-4");
  
  function dbConnect() {
  
      $db = mysqli_connect(DB_HOST, DB_DATABASENAME, DB_PASS, DB_USERNAME);
  
      if (!$db)
          return null;
  
      mysqli_query($db, 'SET NAMES utf8');
  
      return $db;
  
      }
  </code></pre>
  
  <p>Other functions:</p>
  
  <pre><code>function arkadasEkle($db, $name, $pass) {
  
      $sorgu = "INSERT INTO deneme123 (name, pass) VALUES ('$name', '$pass')";
  
      if(!mysqli_query($db, $sorgu))
          return false;
  
      return true;
  
  }
  ?&gt;
  </code></pre>
  
  <p><code>addclient.php</code>:</p>
  
  <pre><code>&lt;?php
  
  //require_once('functions.php'); 
  
  include('functions.php');
  if((!isset($_POST['name']) || empty($_POST['name'])) &amp;&amp;
     (!isset($_POST['pass']) || empty($_POST['pass'])))
      die(BASARISIZ);
  
  $name= $_POST['name'];
  $pass= $_POST['pass'];
  
  $db = dbConnect();
  
  if(arkadasEkle($db, $name, $pass))
      die(BASARILI);
  
  die(BASARISIZ);
  
  ?&gt;
  </code></pre>
  
  <p>These php files are in <code>C:\wamp\www\kimnerede</code>directory.</p>
  
  <p>This is the class where the connection and the insertion is made:</p>
  
  <pre><code>public class NewProductActivity extends AsyncTask&lt;String,Void,String&gt;{
  
      public static final String KIM_NEREDE_BASE_URL = "http://10.0.2.2/kimnerede/";
      public static final String KIM_NEREDE_PROFIL_KAYDET_URL = KIM_NEREDE_BASE_URL + "addclient.php";
      private static final String TAG = "NetworkManager";
  
      private Context context;
  
      public NewProductActivity(Context context)
      {
          this.context = context;
      }
  
      public static String Ekle(String p_name, String p_pass)
      {
          BufferedReader in = null;
  
          try {
  
              HttpClient client = new DefaultHttpClient();
              HttpPost request = new HttpPost(KIM_NEREDE_PROFIL_KAYDET_URL);
  
              List&lt;NameValuePair&gt; parametreList = new ArrayList&lt;NameValuePair&gt;();
              parametreList.add(new BasicNameValuePair("name", p_name));
              parametreList.add(new BasicNameValuePair("pass", p_pass));
  
              HttpResponse response = client.execute(request);
  
              in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
  
  
              return in.readLine();
          } catch (Exception e) {
              Log.d(TAG, "Profil kaydedilirken hata olustu", e);
          } finally {
              if (in != null) {
                  try {
                      in.close();
                  } catch (Exception e) {
                      e.printStackTrace();
                  }
              }
          }
  
          return null;
  
      }
  
      @Override
      protected String doInBackground(String... params) {
  
          Ekle(params[0],params[1]);
  
          return null;
      }
  }
  </code></pre>
  
  <p>This class is called by creating an object in <code>LoginActivity.java</code>:</p>
  
  <pre><code>public void SignUpClicked(View view) {
  
          new NewProductActivity(this).execute(UserName.getText().toString(),Password.getText().toString());
  
      }
  </code></pre>