views:

101

answers:

3

Hi,

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?

A: 

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.
Thanks Wadih. Do you have any examples I can use?
AAA
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.
Any reference sites for jQuery then?
AAA
Yes, you may refer to my post there's the link inside. http://jquery.org
Wadih M.
+1  A: 

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.

Col. Shrapnel
Thanks Col. Shrapnel. Understand it better.
AAA
A: 

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

slebetman