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?

user3075740
  • 119
  • 1
  • 3
  • 9
  • Doesn't matter what kind of server you use. What did you change that the androidhive example doesn't work? – greenapps Jun 17 '14 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. – user3075740 Jun 18 '14 at 02:35
  • also i have used spinners to input data instead of editText in my android code. – user3075740 Jun 18 '14 at 03: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. – greenapps Jun 18 '14 at 08:02

1 Answers1

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.