Sync Android with website database?

So this is what I need to do before my internship ends.

  • connect the android application to the database from the website
  • save some information in the database
  • get information from the database

I already have experience using the standard sqlite build in Android apps. The problem is that I need people to get some information from the server, so they can exchange information with the rest. I have 3 weeks left before I go with my internship, so any help would be very helpful.

+3
source share
1 answer

1) Create a SQLite database (Windows GUI SQLite prog: http://sqliteadmin.orbmu2k.de/ )

2) Put it on the server

3) create a php script that will update / read your database (on the server)

<?php $row_id = $_GET['yourRowId']; $submitted_var = $_GET['yourUpdateVar']; if($database = new PDO("sqlite:your_sqlite_database.s3db")){ //insert data into database $query = "UPDATE your_table SET some_field=$submitted_var WHERE _id=$row_id"; $database->query($query); echo DONE; } else { die($err); } ?> 

4) Call this php script from your Android app.

  http://yourserver/yourfolder/yourscript?yourRowId=1&yourUpdateVar=3 http://yourserver/yourfolder/yourReadScript (parse html response) 

Done

The way I do it in 3 weeks :-)

OOI was an oral internship @?

+7
source

Source: https://habr.com/ru/post/909978/


All Articles