-1

Hi i have my own hosting and i have created a database there in which i have two columns

host = "mysql.hostinger.in"
database = "mydatabase"
username = "myuser"
pass = "123"

TABLE = "Data"

'email' = column (TEXT)
'eligible' = column (INT)

now what i want to do is i need to contact my database to check if the email suppose "abc@xyz.com" is eligible ie. "1" means YES and "0" means NO

so how i connect to my database from android java any code snippet ? also is this require to put password for database to contact ? what if anybody decompile my application and get username and password then he can interfere which i do not want

  • do not want to put my sqldatabase password to fetch the data how could i do that ,someone said i need webservice to do that i am not good with php
  • 2
    Possible duplicate of [Android - Connecting to MySQL database](https://stackoverflow.com/questions/4707656/android-connecting-to-mysql-database) – Skarlinski Oct 29 '17 at 14:28
  • not duplicate there is difference i want to fetch the information without putting password for connection – Adam Jones Oct 29 '17 at 14:31
  • You need to connect to the mysql server first. I suggest you find a tutorial about mysql and android – Skarlinski Oct 29 '17 at 14:33

1 Answers1

0

If you have your own hosting, you could make little Rest, making and putting up PHP script on your server that returns for example JSON and get it in your App using JSON parser (f. ex. Volley Library). Your PHP file would hold all database connections etc

M. Wojcik
  • 2,301
  • 3
  • 23
  • 31
  • could you please give me a small code snippet for that specially with php as i do know anything about php – Adam Jones Oct 29 '17 at 14:32
  • Sure, here you have full tutorial: https://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/ and here: https://www.tutorialspoint.com/android/android_php_mysql.htm – M. Wojcik Oct 29 '17 at 14:58