Loading...

Android MySQL Database Tutorial 2 - Android Login with PHP MySQL

Android MySQL Database Tutorial 2 - Android Login with PHP MySQL
Code -
 http://www.codebind.com/android-tutorials-and-examples/android-mysql-database-tutorial-android-login-php-mysql/

Hi welcome to this short series on Android MySQL Database Tutorial for beginners. In Android PHP/MySQL Tutorial I will use PHP to create a back-end rest server. In this first video I will show How to Create  Android Login page with PHP MySQL. It is the Best tutorial for android PHP and MySQL. This tutorial series will cover  How to connect Android app to MySQL database?, Android Tutorial - Connect Android to MySQL Database, Android Login and Registration with PHP, MySQL , Android Login Form Tutorial with MySQL and PHP, How to create Simple Login form using php in android, android studio mysql connection, android php mysql json tutorial, Android Login and Registration with PHP, MySQL.

-------------------Online Courses to learn----------------------------
Java - https://bit.ly/2H6wqXk
C++ - https://bit.ly/2q8VWl1
AngularJS - https://bit.ly/2qebsLu
Python - https://bit.ly/2Eq0VSt
C- https://bit.ly/2HfZ6L8
Android - https://bit.ly/2qaRSAS
Linux - https://bit.ly/2IwOuqz
AWS Certified Solutions Architect - https://bit.ly/2JrGoAF
Modern React with Redux - https://bit.ly/2H6wDtA
MySQL - https://bit.ly/2qcF63Z
----------------------Follow---------------------------------------------
My Website - http://www.codebind.com
My Blog - https://goo.gl/Nd2pFn
My Facebook Page - https://goo.gl/eLp2cQ
Google+ - https://goo.gl/lvC5FX
Twitter - https://twitter.com/ProgrammingKnow
Pinterest - https://goo.gl/kCInUp
Text Case Converter - https://goo.gl/pVpcwL
-------------------------Stuff I use to make videos -------------------
Stuff I use to make videos
Windows notebook – http://amzn.to/2zcXPyF
Apple MacBook Pro – http://amzn.to/2BTJBZ7
Ubuntu notebook - https://amzn.to/2GE4giY
Desktop - http://amzn.to/2zct252
Microphone – http://amzn.to/2zcYbW1
notebook mouse – http://amzn.to/2BVs4Q3
------------------Facebook Links ----------------------------------------
http://fb.me/ProgrammingKnowledgeLearning/
http://fb.me/AndroidTutorialsForBeginners
http://fb.me/Programmingknowledge
http://fb.me/CppProgrammingLanguage
http://fb.me/JavaTutorialsAndCode
http://fb.me/SQLiteTutorial
http://fb.me/UbuntuLinuxTutorials
http://fb.me/EasyOnlineConverter

RRelated Posts

CComments

  • MD Sabbir Hossain
    In this code after the dialogue box(Login Status) end if i want to show a new activity where i have to code to show new activity? and what willbe the code?
  • Morey
    amazing for newbies thanks!!
  • A. Aphise Traore
    kawaljeet singh
    "I created exact app code but when i enter username and password it promted only "LOGIN STATUS" nor succes niether not success.
    i want to declare that i run this apk on my real device not on emulator.
    thanking you in anticipation. "

    Flávio Amorim
    " After trying everything I found out a problem with Cleartext HTTP traffic and with bit of research I found the solution in this site "

    https://stackoverflow.com/questions/50334686/cleartext-http-traffic-to-192-168-1-2-not-permitted?noredirect=1&lq=1

    I confirm this to be the fix. (Credit to stackoverflow and Flavio Amorim)
  • Csc Row
    sir please tell me if i want to go next activity after the login what should i do?
  • Devarsh Bhatt
    and how can i start a new activity when i click on that login button?
  • nisha avasthi
    Thank You SO Much Sir...
    Please share any video to display complete data from table and images as well
  • Csc Row
    sir, I want to login or register in different mobile so what should i do sir?only need to replace ip then it will work.
  • Mansour Mohmand
    please help me
  • Mansour Mohmand
    sir onPostExecute(String result) the result is printing "null" i dont know why
    and i checked the php script also but still it is null, showing nothing in the alertDialog,setMessage(result).
  • Ali Raza Abbasi Channel
    every time i click login button it gives me login unsuccessful. i thing POST method is not passing values from java class to php file. what should i do?
  • Fanny Delaroque
    Hello.
    Thank you for this tutorial.
    I am trying to open an other activity in my onPostExecute method but it doesn't work. Do you know why?

    @Override
    protected void onPostExecute(String result) {

    if (result.equals("Connexion réussie") ){
    Intent intent = new Intent(context, MainActivity.class);
    context.startActivity(intent);
    }
    else {
    alertDialog.setMessage(result);
    alertDialog.show();
    }
    }

    here my login.php file
    <?php
    require "connection.php";
    $user_name = $_POST["username"];
    $user_password = $_POST["password"];
    $mysql_query = "select * from utilisateur where identifiant = '$user_name' AND password = '$user_password';";
    $result = mysqli_query($connection, $mysql_query);
    if (mysqli_num_rows($result) > 0)
    {
    echo "Connexion réussie";
    }
    else {
    echo "Erreur identifiant ou mot de passe";
    }
    ?>

    Thank you for your help
  • Gabszyztyle Cordero
    WORST TUTORIAL FOR ANDROID STUDIO, VERY POOR EXPLANATION.
  • Hassen Brk
    hi sir i have a problem when i click login the app shutdown , iverified evrey litle details but the problem still exist plz help
  • Mihajlo Ilic
    Horrible code inside try catch! :D
  • Dpzs Biswa
    Brother, your login.php coding shows some error. Can you help me out of this
    ??
  • Lee Murphy
    Still can't get the actual message in the dialog, only the title... SOMEONE PLEASE HELP
  • Aditya Golu
    Thanq for this great video very helpfull... its working fine i just make changes in it that when user-&-password will correct it will open a new activity bt.. their im getting trouble in fetching data on the new activity ! how to show the data i.e., name of the user on new activity ?
  • raaj kumar
    I have tried this code but the result value is null how to resolve it can you help me anyone??
  • ACTIVE CROP
    i got an error com.example.vishnukv.activecop.Home_Page$2 cannot be cast to android.content.Context when i run app
  • ACTIVE CROP
    com.example.vishnukv.activecop.Home_Page$2 cannot be cast to android.content.Context
  • Crab Man
    I just realized he never created the ON CLICK BUTTON!! Maybe that will help out. I couldn't get it to work because I thought it was the ip address thing, but that was the problem. :) hope this helps!!!
  • Filip Husnjak
    I wrote the exact same code and created database on phpMyAdmin. I can run php scripts in my browser without any problem and it inserts new users too, but whenever i run my android app with your code i found out with debugger that the line "OutputStream outputStream = httpURLConnection.getOutputStream();" throws IOException and nothing happens to the database/table. I tried with many versions of http link but it just throws that exception. I also check which ip adresses my local host and tried with the same link that works in the browser and still it threw the same exception. Please if someone can help. Thank you
  • MAK
    i am getting "login not success" even if i am entering correct username and password...any solution...???
  • Johnina Marie Beguia
    how can I go to the next layout once the login is successful?
  • American Citizen
    God those WIX ads are annoying.
  • Harshit Joshi
    I login then it shows login status and nothing else .
    Help
  • Rohit Tailor
    sir i created my BackgroundWorker class but when i am trying to create its instance in mainactivity its not happening, i mean its not showing backgroundworker class. plz help with this
  • Alex Rayo
    Thank u for the tutorial man,

    HERE THE SOLUTION TO BANK RESPONSE ON DIALOG WINDOW:
    You get nothing because you are receiving a "null" response;
    this is why the address is wrong on your directory "login_url" string.

    Example:
    You have created a folder named "myphpfiles" and inside u have the login.php file;
    if you just write "http://192.168.1.6/login.php" you will get a "null" response because the file has not found;
    so you need to write the name folder too: "http://192.168.1.6/myphpfiles/login.php"

    As a quick tip: ALWAYS CHECK YOUR "LogCat" WINDOW

    Note: I use XAMPP

    this is my piece of code(no "Intent" need it) :
    @Override
    protected void onPostExecute(String result) {
    if(result!=null){
    alertDialog.setMessage("Php response from login.php: "+result);
    alertDialog.show();
    }
    else
    alertDialog.setMessage("No file found: "+result);
    alertDialog.show();
    }
  • Woraprat Mindo
    finished, thank you
  • Mohamed Arshath
    i had problem,when i click login button it shows "login status" !! can anyone tell me how to solve this.. please ?
  • siva kumar
    Hi, I am using Android studio 3.1.3 version. I texted entire code as you explained. When I am running the app in api 24, its working fine. But when I am trying to run in marshmallow or kitkat or any other version its not working after clicking on button(Stopped & closing app). Plz tell me if any libraries to add in the dependencies. Thank you.
  • Neelesh Kumar
    Video is good. But the channel doesn't even reply to the problems what everyone is facing. Even I have the same problem of "LOGIN STATUS" in alert dialog box.
    Now please don't tell me to check ip address,port no,spelling mistake all crap things. I have checked all those stuffs. And I am using MAMP. so tell me accordingly. Thank you to the viewers and fuck off to the channel.
  • harut hakobyan
    Solved it! I changed my emulators API level and it worked
  • Sudershan Singh
    Nice tutorial sir, but what's the point of writing "iso-8859-1" we can also use "UTF-8" is there any special reason of doing this? please tell me.
  • Prashanth v
    great work bro
  • ahmed zerzih
    Thanks alote for this free courses.
  • mokonyana tsiu
    clearly your code has a lot of bugs,can you come up with an updated version?
  • Romin Xavier
    I'm using Android studio 3.1.1...its full of error
  • Sunny Rock8
    hi when i click on the login button it shows:
    connection successful and then a lot of HTML code and then login unsuccessful
  • QWERTY ASDFGH
    im having a problem in BackgroundWorker part, it says "error: cannot find symbol class BackgroundWorker" even tho i did the tutorial exactly. help please
  • Jacky Lim
    Hi i am having the problem of showing the login success where i only got the title of the dialog which is login status. What can i do to fix it? I am using a XAMPP . Thanks
  • Tushar Gangurde
    i want to go on next acticity after login success
  • SGR
    I have run in android emulator but how to run in real device my laptop wifi adapter ip adress is refusing or not working
  • Ahsan Nazir
    How can i start new activity depending upon result of login script. For example if username passwor is correct, new activity should be started otherwise error message. I know how to start activity.
  • Anchal Sheware
    Hello sir I am getting this error "InputStream is abstract; cannot be instantiated ".Can u help me with it asap.
  • Brosnan Degenaar
    Your Videos Are The Best! Made my life so much easier! Thank you!
  • Prince Asare Amankwa
    where should i insert the code to link to new activity if a login in successful. same for the codes registration page
  • Yakov Shitrit
    Is it secure(CSRF proof)? Can I implekent something like a token to secure it?