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

  • SEARCH
  • Home
  • 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 9143843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:07:25+00:00 2026-06-17T10:07:25+00:00

Hi I am new to android and I am developing an app which has

  • 0

Hi I am new to android and I am developing an app which has a login screen.

I have tried many tutorials but I am not sure how to connect the mysql database to my android app. In all the tutorials they have used php to connect the android app to the database.

What I want to know is that where exactly do I need to place the php file and where and how I need to create the php file.

I am creating the database using mysql workbench.

I am using eclipse 4.2 to write the java code.

Hi i am using the following code to check whether the user name i entered is correct or not along with the php code but the problem is that it always gives incorrect username.

String response = null;
try {
response = CustomHttpClient.executeHttpPost("http://192.168.3.27/abc/check.php", postParameters);  //Enetr Your remote PHP,ASP, Servlet file link
String res=response.toString();
// res = res.trim();
res= res.replaceAll("\\s+","");
//error.setText(res);
error.setText(res);
if(res.equals("1")){
    Intent myIntent = new Intent(LoginActivity.this, HomeActivity.class);           
startActivity(myIntent);

}
else
error.setText("Sorry!! Incorrect Username or Password");

This is my php code.

<?php
$un=$_POST['username'];
$pw=$_POST['password'];
//connect to the db
$user = ‘root’;
$pswd = ‘root’;
$db = ‘mylogin’;
$conn = mysql_connect(‘localhost’, $user, $pswd);
mysql_select_db($db, $conn);
//run the query to search for the username and password the match
$query = “SELECT * FROM userpass WHERE login_id = ‘$un’ AND login_pass = ‘$pw’”;
$result = mysql_query($query) or die(“Unable to verify user because : ” . mysql_error());
//this is where the actual verification happens
if(mysql_num_rows($result) > 0)

echo 1;  // for correct login response
else
echo 0; // for incorrect login response
?>
  • 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-17T10:07:27+00:00Added an answer on June 17, 2026 at 10:07 am

    where exactly do i need to place the php file

    You need to place PHP file in server. (You can use localhost i.e., your machine but for devices outside you need to keep it on a webserver which you need to purchase a domain and hosting services.)

    where and how i need to create the php file.

    You can create a PHP file in you machine itself. Its as simple as creating a text file but with an extension of .php. Using a wamp on windows (LAMP for linux)you can test it. It has a MySQL in it. LAMP and WAMP will have apache server by default.

    Soon after you are finished with writing you php code and testing you can transfer the files through FTP into your webserver. Now to configure the MySQL database you can actually use a control panel at the webserver.

    You need to use URL for android application to link the PHP files in turn these PHP files interact with MysQL. for a login lets think like you have created a php file as login.php. On your localhost you can refer it to as http://localhost/myapp/login.php If you need to get it on a webserver which you purchase then you URL will have http://www.yourwebsite.com/myapp/login.php. note that myapp is just a folder where you have uploaded your php files.

    Now its just a way by which you can actually have a PHP and MySQL for you android application. I think that tutorials have taught you about using php and mysql connections. For Data exchange you need to know about XML or JSON I think tutorials followed had given you an introduction about it.

    You even have a plugin for eclipse to work with php. Just get a help over internet on how to install it. This video might help you.

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

Sidebar

Related Questions

I am new in android. I am developing a App in which i have
I am developing an android app which has Facebook integration in it. I have
I am very new to android and I am developing this app which allows
I am developing an android app which is intended to use Facebook login.Users will
I am developing an android app in which I have to present the user
I am developing a android app in which i have to expand the particular
I am new to android app development.I am developing an android app which is
I am developing an android app in which I have 3 spinners populated from
I am new to Android, I am developing a simple and small app, which
I am developing an android app which has a button in one activity and

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.