2

Is it possible with Android to get data from my xamp or wamp database(phpmyadmin).

I want to create a database in wamp, and later on the app should build up a connection to that database and get the data.

Would this be possible? I googled quiet a bit, but could not find something suitable.

Isaac Bennetch
  • 11,830
  • 2
  • 32
  • 43
Malizunin
  • 21
  • 2

3 Answers3

1

create webservices which you will call from your device. this webservice will connect to xamp or wamp nd get data from mysql http://www.tutorialspoint.com/android/android_php_mysql.htm http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/

Nidhin Prathap
  • 696
  • 5
  • 15
1

I would strongly discourage you from trying to get your Android app to connect directly to the remote database (e.g. to mySql on port 3306).

Rather, the best approach would probably be:

  1. Create a simple web front end

  2. Your Android connects to the web front end (via HTTP)

  3. The web server connects to the database (directly on the web server/database host).

There are many, many ways to approach this. Since you're developing for Android, I assume you're probably familiar with Java. So this might be a good starting point:

paulsm4
  • 114,292
  • 17
  • 138
  • 190
0

As long as you aren't doing something that needs to update a lot (e.g. a realtime, multiplayer videogame) you could just load a webpage as a string in the app:

InputStream in = new URL( "http://example.com/data.php?param=something" ).openStream();
String data = "";
try {
    data =  IOUtils.toString(in);
} finally {
    IOUtils.closeQuietly(in);
}

from Read url to string in few lines of java code

Then in data.php:

<?php
    echo data_from_param($_GET['param']);
?>
Community
  • 1
  • 1
Brandon Dyer
  • 1,316
  • 12
  • 21