- I have MySQL database server
- I need to update and retrieve data to/from MySQL server via JSON
So, I want to know how to do that, and I pretty confuse with this example statement:
HttpPost httppost = new HttpPost("http://10.0.2.2/city.php");
This means I need to code my application that connect with PHP server
before write php to connect to DB right ?
To send data to server you could do this:
then to send lets say:
so then the AddAccelerationData.php file on server is:
This is an example I used recently. Just to note in the php file. I import Connection.php
this just deals with the connection to the database. So just replace that with your code for connecting to MYSQL db. Also I imported SendAPI.php (which you can just ignore)This was just my class for sending data. Basically it contained some of the querys I wanted to use. Such as sendAccelerationData(). Basically class was similar to that of stored procedures.