In the tutorial you will learn how to make a connection between a server and an android app. You will also learn how to send and get data from the database …
Original source
In the tutorial you will learn how to make a connection between a server and an android app. You will also learn how to send and get data from the database …
Original source
29 responses to “Connect Android App To Database (Complete Register & Login Tutorial)”
Just a pointer on PHP. There is no sanitizing of the input variables (POST) nor use of prepared statements (mysqli), so this is wide open to SQL injection.
plz reply must
where is the code that you saying below description?????
null info is getting added to my database, and when I login/register, I get null for name, password and email. I'm getting an exception: Value Exception of type java.lang.String cannot be converted to JSONObject. Does anyone know how I can fix this?
i get null value on my android studio, but when i try the php file on my web, the json value is working fine. I think my app cant get the value from the php. Any suggestion?
dude you are love <3
Hi +Het Patel thanks for the great tutorial. I have a question when I using url 127.0.0.1 or localhost it will show the exception, but when I use 10.0.3.2 and click register It didnt happen anything. what should I do ?
Thank you so much! being searching for this from past few days ?
شكرا وجزاك الله خيرا بما انفعت الناس جميعا
null info is getting added to my database, and when I login/register, I get null for name, password and email. I'm getting an exception: Value Exception of type java.lang.String cannot be converted to JSONObject. Does anyone know how I can fix this?
i think you should have spoken hence new programmers will not understand whats happening here
where php files should be saved?
+het patel ,i use my android phone to test,but it keeps showing "fail to connect to 10.0.2.2(port 80) after 3000ms" once i clicked on the register button.
pls help~~!
what should i change in the PHPs to send the datas to my Ubuntu Server?
It worked!, thanks
Should i create the database ?
can you please tell me where(path) should i create the php file inorder to access it by localhost…waiting for ur reply..Thank you
Hi Sir Het
When login to show value in Home.java , I have error JSONException: Value of type java.lang.String cannot be converted to JSONObject . Why ??
I checked login.php no have the error .
How fix to solve it. ?
help me please~~
i have problem when i input data in register, there's message {"message":"Unable to save the data to the database."}.
can anyone help me please ?
hey bro, i try to pass the user data to home activity, but it say "welcome : null", can you help me solve this ?
hello bro , u said to use 10.0.3.2 if i use android emulator . but what if i use my phone to run and debug the apps ? what should i use ? pls reply ASAP if anyone know , i need to fix it by tonight T^T
is there no sound or is my computer fucked?
hay! when i want to run my app i face an error like Unfortunately, "APP NAME" has stopped.
This is the most helpful tutorial!! thanks to you finally i make it worked!! I recommend this to all people who wants to learn login and register using android studio with php mysql file.
Thanks for this great tut.i am using my mobile handset for running app so what is the ip for connecting database 127.0.0.1, 10.0.3.2 or 10.0.2.2
Thanks! This is great. I do have a couple of questions though:
1) How does the java code know that the `main_login()` function in the main.java file needs be ran after the 'login' button is clicked? I don't see an `event listener`, so I'm confused about this.
2) In Main.java, within the 'protected String doInBackground(String… params)' function, why does the data in 'return data' get passed into 'String s' on the 'onPostExecute' function? Is it because they're within the same class, so the returned data from the 'doInBackground' function gets passed directly into the 'onPostExecute' function?
help i need a database that can be accessed online in an actual android device how do I do that ?
Help!!.. When i Fill up and press Register.. it says Data has been saved .. but in the database no data found
Why when I enter wrong username or password this error appears ( Exception : Value[] at user_data of type org.json.JSONArray cannot be converted to JSONObject )