MySQL Remote Access Mobile Application

I am a PHP programmer and new to mobile development. I researched and found information that shows that the only way to connect a MySQL database is to use jquery to retrieve or send information from HTML5 pages to the database using PHP scripts. I have the following table in my database:

table name: employees

1 - Id
2 - firstName
3 - lastName
4 - lastUpdate

I would like to list all the employees in the table in the DIV content of my mobile application, and then be able to click on any employee and send the actual date in the lastUpdate field.

Please have a hint or any place where I can see instructions and develop my work? Thank you in advance.

+4
source share
1 answer

Since you are a php programmer, it will be easy for you to make a php script that executes a query in the database and returns a (echo) json object. The scenario is as follows:

  • Make a php script. It executes a query, collects data, and constructs a json object. Then you echo this object back.
  • You make a javascript (jquery, if you want) script that in the event (click a button, submit a form, etc.) sends a request using ajax (it can be synchronous or asynchronous) to this script. Suppose this is a POST request.
  • Your php script is activated when this request is executed and returns data (json).
  • Your jquery script receives the data, and in the for loop it builds the div you want.

Check out the answers in this jQuery AJAX POST example with PHP . This is a good start and contains all the necessary details for your project. If you encounter problems, start with your php script, make sure it works and updates your answer. After that, the client side becomes easy.

+1
source

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


All Articles