title: Android app won't store data in a database
body: <h1>---BACKGROUND---</h1>
  
  <p><em>I'm a total noob, the definition of a beginner programmer. Please, when responding, keep that in mind. :)</em></p>
  
  <h1>---STORY---</h1>
  
  <p>So in short, my android application i'm working on is supposed to have a registration/login form and the main content "behind" that. Basically, the user in order to get access to the application and it's content first must register himself an account, the account details should get stored in a database, and after that at the login form when the user is trying to sign in with their believed username and password the application should check whether the username/password he/she put in is right or not(obviously, if both are right he gets past the login form and gets access to the content, if not, then he gets reminded that either the password, username or both he tried logging in with was wrong). </p>
  
  <h1>---PROBLEM---</h1>
  
  <p>After I put in all the details needed at the registration form(firstname,lastname,username,password,email) and click the button, my app, as it should, starts a new activity(the login form), where I should be able to sign in with the username and password I earlier chose. But, the problem is, no matter how hard I try, the database just won't get updated with any of the details(username, firstname, lastname, pw and email). The interesting part is that I'm following a tutorial <a href="https://www.youtube.com/playlist?list=PLe60o7ed8E-TztoF2K3y4VdDgT6APZ0ka" rel="nofollow">https://www.youtube.com/playlist?list=PLe60o7ed8E-TztoF2K3y4VdDgT6APZ0ka</a> to make the app, and even with the original files provided by the maker of that tutorial series, my app still won't update the database after the user completes the registration form. The hosting company I'm using is
          <a href="https://www.siteground.com/" rel="nofollow">https://www.siteground.com/</a> .</p>
  
  <h1>---TLDR---</h1>
  
  <p>My Android Application should have the content hidden behind a registration/login form, if the user successfully registers he should be able to 
  sign in with the username and password he chose. The details the application asked for during the registration process (firstname, lastname, username, password, email) should be stored in a database. The problem is that after filling in the registration form
  the database won't get updated. </p>
  
  <h1>LAST BUT NOT LEAST, THE CODE:</h1>
  
  <p><strong>RegisterActivity.java</strong>
  `</p>
  
  <p>public class RegisterActivity extends AppCompatActivity {</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_register);
  
      final EditText etEmail = (EditText) findViewById(R.id.etFirstName);
      final EditText etLastName = (EditText) findViewById(R.id.etLastName);
      final EditText etFirstName = (EditText) findViewById(R.id.etUsername);
      final EditText etPassword = (EditText) findViewById(R.id.etPassword);
      final EditText etUsername = (EditText) findViewById(R.id.etEmail);
      final Button RegisterButton2 = (Button) findViewById(R.id.RegisterButton2);
  
      RegisterButton2.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              final String firstname = etFirstName.getText().toString();
              final String lastname = etLastName.getText().toString();
              final String username = etUsername.getText().toString();
              final String password = etPassword.getText().toString();
              final String email = etEmail.getText().toString();
  
              Response.Listener&lt;String&gt; responseListener = new Response.Listener&lt;String&gt;(){
                  @Override
                  public void onResponse(String response) {
                      try {
                          JSONObject jsonResponse = new JSONObject(response);
                          boolean success = jsonResponse.getBoolean("success");
                          if (success){
                              Intent intent = new Intent(RegisterActivity.this, LoginActivity.class);
                              RegisterActivity.this.startActivity(intent);
                          } else {
                              AlertDialog.Builder builder = new AlertDialog.Builder(RegisterActivity.this);
                              builder.setMessage("Register Failed")
                                      .setNegativeButton("Retry", null)
                                      .create()
                                      .show();
                          }
                      } catch (JSONException e) {
                          e.printStackTrace();
                      }
                  }
              };
  
              RegisterRequest registerRequest = new RegisterRequest(firstname, lastname, username, password, email, responseListener);
              RequestQueue queue = Volley.newRequestQueue(RegisterActivity.this);
              queue.add(registerRequest);
          }
      });
  }
  </code></pre>
  
  <p>`</p>
  
  <p><strong>RegisterRequest.java</strong></p>
  
  <pre><code>public class RegisterRequest extends StringRequest {
  private static final String REGISTER_REQUEST_URL = "http://wearelifemap.com/Register.php";
  private Map&lt;String, String&gt; params;
  
  public RegisterRequest(String firstname, String lastname, String username, String password, String email, Response.Listener&lt;String&gt; listener){
      super(Method.POST, REGISTER_REQUEST_URL, listener, null);
      params = new HashMap&lt;&gt;();
      params.put("firstname", firstname);
      params.put("lastname", lastname);
      params.put("username", username);
      params.put("password", password);
      params.put("email", email);
  }
  
  @Override
  public Map&lt;String, String&gt; getParams() {
      return params;
  }
  </code></pre>
  
  <p><strong>Register.php</strong></p>
  
  <pre><code>&lt;?php
      $con = mysqli_connect("localhost", "wearelif_xtreme", "abc123",     "wearelif_user2");
  
  $firstname = $_POST["firstname"];
  $lastname = $_POST["lastname"];
  $username = $_POST["username"];
  $password = $_POST["password"];
  $email    = $_POST["email"];
  $statement = mysqli_prepare($con, "INSERT INTO user (firstname, lastname, username, password, email) VALUES (?, ?, ?, ?, ?)");
  mysqli_stmt_bind_param($statement, "sssss", $firstname, $lastname, $username, $password, $email);
  mysqli_stmt_execute($statement);
  
  $response = array();
  $response["success"] = true;  
  
  echo json_encode($response);
  </code></pre>