4

I am a PHP programmer and new with mobile development. I have researched and found information that shows that the only way to connect a MySQL database is using the jquery to retrieve or send information from the 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 in the content DIV of my mobile app all employees within the table and then be able to click on any employee and send the actual date to the lastUpdate field.

Please, is there any tip or any place where I may see instructions and develop my work? Thank you in advance.

1 Answers1

1

Since you are a php programmer it will be easy for you to make a php script that does the query on the database and returns (echo) a json object. The scenario is like this :

  1. Make the php script. It does the query, collects the data and constructs a json object. You then echo that object.
  2. You make the javascript (jquery if you prefer) script that on an event (click a button, submit a form etc) sends a request by ajax (it can be synchronus or asynchronus) to that script. Lets assume that is a POST request.
  3. Your php script is activated when that request takes place and returns the data (json).
  4. Your jquery script receives the data and in a for loop constructs the div that you want.

Check the answers in this jQuery Ajax POST example with PHP. It's a good start and contains all the necessary parts for your project. If problems arise, begin with your php script, make sure it works and update your answer. The client side is easy after that.

Community
  • 1
  • 1
Alkis Kalogeris
  • 17,044
  • 15
  • 59
  • 113
  • I saw few differences in a regular jquery structure of a regular website and the mobile website but the logic is the same. I did it and it is working fine. I know that is some secrets that I have to find out but I will get them. Appreciate your comments. Very helpful. – Alex Araujo Aug 29 '13 at 03:44
  • No problem. Have fun. – Alkis Kalogeris Aug 29 '13 at 05:17