0

I am a newbie in android and working on an app. I will be using a database on a server but meanwhile I have created a database on xampp and followed this link to connect my app with the database. I am trying to register a user and store his details into my db. I have created 3 files in xampp/htdocs folder: Config.php , DbConnect.php and new_user.php to add a new user into the database. I am using the

url_create_product = "http://localhost/Signup_api/new_user.php"

where Signup_api is my folder in xampp/htdocs. I have also created a JSONParser.java file in my src folder along with main activity. But the app shows "Creating product.." message for a few minutes and then stops. Has anyone tried to connect android app to xampp before? Please share your experience. Is it necessary to use wamp?

4
  • Doesn't matter what kind of server you use. What did you change that the androidhive example doesn't work? Commented Jun 17, 2014 at 16:08
  • I changed the url because I wanted to connect app with my database. I have 10 fields in my db table so I made changes in the create_product.php to accept 10 entries instead of 3. In android src folder I have made only NewProductActivity.java to add a new user, and JSONParser.java as it is. I think the problem is with the url. I used my IP address, and 10.0.2.2 but it doesn't work. Commented Jun 18, 2014 at 2:35
  • also i have used spinners to input data instead of editText in my android code. Commented Jun 18, 2014 at 3:38
  • You changed so much and you have so many files. Then you cannot tell us if it is a connection problem or wrong code. So there is a lot to find out. Lets start with one php file which you try to call with your android client. Post code of the client posting/getting the php file. Commented Jun 18, 2014 at 8:02

1 Answer 1

1

use ip address instead of localhost ... Example http://locahost/xxxx/index.php will be http://192.x.x.x/..../index.php. Test on android browser it can access or not first.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.