0

I am trying to build a php/mysql website. But in the past, i didn't like the way php handled insert, update, delete, showing of entries. Ever since I have seen AJAX implemented beautifully on so many sites, i want to be able to do the same?

I am familiar with how to use PHP to accomplish:

DB Insert, Edit, Delete, and show. But how can I do the same using AJAX? And how to show error messages and user-name availability live as well?

AAA
  • 3,120
  • 11
  • 53
  • 71

3 Answers3

1

You can't Insert, Edit, Delete, and show data using AJAX.
You can just call corresponding server side scripts, which will do the job.
Thus, old good PHP is still the only way. You can only add AJAX to your site, not replace PHP with it.

Anyway your question is too broad and you have to read some article first and then ask certain questions, if any.

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
0

Ajax is client-side only.

You can have the browser use the jQuery object to call a PHP page sitting on the server. (http://jquery.org)

The php page would basically do an action (DB Insert, Edit, Delete, and show) related to the query string it was called with, and give a reponse that the jQuery object can parse.

As an AJAX Control, I suggest to start with jQuery. For the PHP page, there's no standard way of doing it, you'll need to create your own, but should be simple. Beginning of the file would be conditional logic to determine which action needs to be done and parsing out the parameters, then building the SQL query to carry out the command.

Wadih M.
  • 12,810
  • 7
  • 47
  • 57
  • Thanks Wadih. Do you have any examples I can use? – AAA Sep 09 '10 at 17:23
  • Hi AAA. As an AJAX Control, I suggest to start with jQuery. For the PHP page, there's no standard way of doing it, you'll need to create your own, but should be simple. Beginning of the file would be conditional logic to determine which action needs to be done, and parsing out the parameters, then building the SQL query to carry out the command. – Wadih M. Sep 09 '10 at 17:28
  • Any reference sites for jQuery then? – AAA Sep 09 '10 at 17:29
  • Yes, you may refer to my post there's the link inside. http://jquery.org – Wadih M. Sep 09 '10 at 17:30
0

See my answer to this question: can-we-connect-database-with-javascript.

Community
  • 1
  • 1
slebetman
  • 109,858
  • 19
  • 140
  • 171