title: Issue Sending data to mysql in android studio
body: <p>I am currently building an app for my university project and I am well and truly stuck. I am currently trying to send data from my apps sign up page to my Mysql database, I have gotten as far as being able to connect due to error logs showing that a connection was successful but no data is being sent to the database?</p>
  
  <p>I have tried multiple ways of sending the data through php but it doesn't seem to make any difference. I was hoping maybe someone could point out my mistake and help me get past this hurdle I have been stuck on for so long.</p>
  
  <p><strong>Signup.java</strong></p>
  
  <pre><code>package com.example.projectv1;
  
  import androidx.appcompat.app.AppCompatActivity;
  
  import android.content.Intent;
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.ImageView;
  import android.widget.Toast;
  
  import com.android.volley.AuthFailureError;
  import com.android.volley.DefaultRetryPolicy;
  import com.android.volley.Request;
  import com.android.volley.RequestQueue;
  import com.android.volley.Response;
  import com.android.volley.VolleyError;
  import com.android.volley.toolbox.StringRequest;
  import com.android.volley.toolbox.Volley;
  
  import org.apache.http.HttpEntity;
  import org.apache.http.HttpResponse;
  import org.apache.http.NameValuePair;
  import org.apache.http.client.ClientProtocolException;
  import org.apache.http.client.HttpClient;
  import org.apache.http.client.entity.UrlEncodedFormEntity;
  import org.apache.http.client.methods.HttpPost;
  import org.apache.http.impl.client.DefaultHttpClient;
  import org.apache.http.message.BasicNameValuePair;
  import org.json.JSONObject;
  
  import java.io.IOException;
  import java.net.URL;
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  
  
  public class SignUp extends AppCompatActivity {
      ImageView nxtPage;
      EditText Fname;
      EditText Lname;
      EditText Email;
      EditText Password;
      EditText RePassword;
      private String sendURL = "https://tg322.brighton.domains/AppPHP/get_data.php";
      private RequestQueue requestQueue;
      private static final String TAG = SignUp.class.getSimpleName();
      int success;
      private String TAG_SUCCESS = "Success";
      private String TAG_MESSAGE = "Message";
      private String tag_json_obj = "json_obj_req";
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_sign_up);
          nxtPage = (ImageView) findViewById(R.id.NextPage);
          Fname = (EditText) findViewById(R.id.editTextFName);
          Lname = (EditText) findViewById(R.id.editTextLName);
          Email = (EditText) findViewById(R.id.editTextEmail);
          Password = (EditText) findViewById(R.id.editTextPassword);
          RePassword = (EditText) findViewById(R.id.editTextRePassword);
  
          requestQueue = Volley.newRequestQueue(getApplicationContext());
  
          nxtPage.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Intent startActivity = new Intent(SignUp.this, HomePage.class);
  
                  startActivity(startActivity);
                  sendData();
              }
          });
  
      }
  
      //public void GetData(){
  
       //   TempFname = Fname.getText().toString();
  
       //   TempLname = Lname.getText().toString();
  
       //   TempEmail = Email.getText().toString();
  
       //   TempPassword = Password.getText().toString();
  
    //  }
  
      private void sendData(){
          StringRequest request = new StringRequest(Request.Method.POST, sendURL, new Response.Listener&lt;String&gt;() {
              @Override
              public void onResponse(String response) {
              try{
                  JSONObject jobj = new JSONObject(response);
                  success = jobj.getInt(TAG_SUCCESS);
                  if(success == 1){
                      Toast.makeText(SignUp.this, jobj.getString(TAG_MESSAGE), Toast.LENGTH_SHORT).show();
                  }else {
                      Toast.makeText(SignUp.this, jobj.getString(TAG_MESSAGE), Toast.LENGTH_SHORT).show();
                  }
  
              }catch (Exception e){
                  Toast.makeText(SignUp.this, "Error Occured " + e, Toast.LENGTH_SHORT).show();
                  }
  
              }
          }, new Response.ErrorListener(){
              @Override
              public void onErrorResponse(VolleyError error){
                  Toast.makeText(SignUp.this, error.getMessage().toString(), Toast.LENGTH_SHORT).show();
  
              }
  
          }) {
              @Override
              public Map&lt;String, String&gt; getParams() {
                  Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
                  params.put("F_Name" , Fname.getText().toString());
                  params.put("L_Name" , Lname.getText().toString());
                  params.put("Email" , Email.getText().toString());
                  params.put("Password" , Password.getText().toString());
                  return params;
              }
          };
          request.setRetryPolicy(new DefaultRetryPolicy(10000, 1, 1.0f));
          requestQueue.add(request);
      }
  
  }
  </code></pre>
  
  <p><strong>DatabaseConfig.php</strong></p>
  
  <pre><code>&lt;?php
  
  
  $HostName = "localhost";
  
  
  $HostUser = "tg322_admin";
  
  
  $HostPass = "1234";
  
  
  $DatabaseName = "tg322_AndroidAppDatabase";
  
  $con = mysqli_connect($HostName,$HostUser,$HostPass,$DatabaseName);
  if(!$con){
      echo "Error occured in connection";
  }
  ?&gt;
  </code></pre>
  
  <p><strong>get_data.php</strong></p>
  
  <pre><code>&lt;?php
  
  include "DatabaseConfig.php";
  class user{}
  $fname = ($_POST['F_Name']);
   $lname = ($_POST['L_Name']);
   $email = ($_POST['Email']);
   $pass = ($_POST['Password']);
   $query = "INSERT INTO 'Login_Details' ('id' , 'F_Name' , 'L_Name' , 'Email' , 'Password') values (NULL, '".$fname."' , '".$lname."' , '".$email."' , '".$pass."')";
  
   mysqli_query($con,$query);
  
  if($query){
      $response=new user();
      $response-&gt;success=1;
      $response-&gt;message="Successfully uploaded";
      die(json_encode($response));
  }else{
      $response=new user();
      $response-&gt;success=0;
      $response-&gt;message="Failed to upload";
      die(json_encode($response));
  }
   mysqli_close($con);
  ?&gt;
  </code></pre>
  
  <p>This is the result when running my app:</p>
  
  <p><a href="https://i.stack.imgur.com/VzHCK.png" rel="nofollow noreferrer">Error Occured org.json.JSONException: No value for Success</a></p>
  
  <p><strong>Edit</strong></p>
  
  <p>After adding <code>error_reporting(E_ALL);</code> to both php scripts, I am confident  that the error does not lie with the php code as no error is being reported. <code>{"success":1,"message":"Successfully uploaded"}</code> This is the response from my php code so I am connecting to the database successfully but I am unsure what the issue is with my android studio code.</p>