Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8883373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:47:50+00:00 2026-06-14T20:47:50+00:00

I am developing an app with eclipse. I tried to store the data that

  • 0

I am developing an app with eclipse. I tried to store the data that key in by user into database in phpmyadmin. Unfortunately, after the user has clicked on submit button, there is no response and data is not stored in my database.

Here is my java file:

import java.util.ArrayList;
import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.content.res.Configuration;

public class UserRegister extends Activity {

JSONParser jsonParser = new JSONParser();
EditText inputName;
EditText inputUsername;
EditText inputEmail;
EditText inputPassword;
RadioButton button1;
RadioButton button2;
Button button3;
int success = 0;

private static String url_register_user = "http://10.20.92.81/database/add_user.php";
private static final String TAG_SUCCESS = "success";

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_user_register);

    inputName = (EditText) findViewById(R.id.nameTextBox);
    inputUsername = (EditText) findViewById(R.id.usernameTextBox);
    inputEmail = (EditText) findViewById(R.id.emailTextBox);
    inputPassword = (EditText) findViewById(R.id.pwTextBox);

    Button button3 = (Button) findViewById(R.id.regSubmitButton);

    button3.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {

            String name = inputName.getText().toString();
            String username = inputUsername.getText().toString();
            String email = inputEmail.getText().toString();
            String password = inputPassword.getText().toString();

            if (name.contentEquals("")||username.contentEquals("")||email.contentEquals("")||password.contentEquals(""))
            {
                AlertDialog.Builder builder = new AlertDialog.Builder(UserRegister.this);


                builder.setMessage(R.string.nullAlert)
                   .setTitle(R.string.alertTitle);

                builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                   public void onClick(DialogInterface dialog, int id) {

                   }
               });

            AlertDialog dialog = builder.show();
            }

            // creating new product in background thread
                RegisterNewUser();  
        }
    });
}


   public void RegisterNewUser()
   {
   try
   {
        String name = inputName.getText().toString();
        String username = inputUsername.getText().toString();
        String email = inputEmail.getText().toString();
        String password = inputPassword.getText().toString();

        // Building Parameters
        List<NameValuePair> params = new ArrayList<NameValuePair>();
        params.add(new BasicNameValuePair("name", name));
        params.add(new BasicNameValuePair("username", username));
        params.add(new BasicNameValuePair("email", email));
        params.add(new BasicNameValuePair("password", password));

        // getting JSON Object
        // Note that create product url accepts POST method
        JSONObject json = jsonParser.makeHttpRequest(url_register_user,
                "GET", params);

        // check log cat for response
        Log.d("Send Notification", json.toString());

        success = json.getInt(TAG_SUCCESS);

        if (success == 1)
        {
            // successfully created product
            Intent i = new Intent(getApplicationContext(), StudentLogin.class);
            startActivity(i);
            finish();
        }

        else
        {
            // failed to register

        }
   }

    catch (Exception e)
    {
       e.printStackTrace();
    }
   }

   @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);

    }
}

my php file:

<?php
$response = array();

require_once __DIR__ . '/db_connect.php';

$db = new DB_CONNECT();


if (isset($_GET['name']) && isset($_GET['username']) && isset($_GET['email']) && isset($_GET['password'])) {

$name = $_GET['name'];
$username = $_GET['username'];
$email = $_GET['email'];
$password = $_GET['password'];


// mysql inserting a new row
$result = mysql_query("INSERT INTO register(name, username, email, password) VALUES('$name', '$username', '$email', '$password')");

// check if row inserted or not
if ($result) {
    // successfully inserted into database
    $response["success"] = 1;
    $response["message"] = "You are successfully registered to MEMS.";

    // echoing JSON response
    echo json_encode($response);
} 
else {
    // failed to insert row
    $response["success"] = 0;
    $response["message"] = "Oops! An error occurred.";

    // echoing JSON response
    echo json_encode($response);
}
} else {
// required field is missing
$response["success"] = 0;
$response["message"] = "Required field(s) is missing";

// echoing JSON response
echo json_encode($response);
}
?>

the log cat is as follows:

11-25 10:37:46.772: I/Choreographer(638): Skipped 30 frames!  The application may be doing too much work on its main thread.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:47:51+00:00Added an answer on June 14, 2026 at 8:47 pm

    Firstly, follow Java naming conventions and keep your method names starting with a lower case.

    Secondly, you must be getting a NetworkOnMainThreadException, because you’re performing the blocking Network operation on your UI thread. You do that and you’re gonna have a bad time.

    Put all your network code within an async task, or at least a separate thread.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an android app using Eclipse. All has been going well until
I'm developing an Android app in Eclipse Helios and I appear to have accidentally
I am developing an Android app using Eclipse 3.7.2 with the Android SDK installed.
I am developing an Android app in Eclipse. I would like to target a
I've been developing an Android app using Eclipse and the Android plug-in for Eclipse
I've been developing an Android app in Eclipse (java) using openGL ES 1.0 on
I am currently developing an Android-App in Eclipse and trying to use a Library
I am developing an Android (API level 7) app in Eclipse 3.7.2. I have
I'm developing new web app with Struts2 framework, eclipse, and I've mapped the db
I am developing a 3D App as a native C++ program. Doing on Eclipse

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.