Ajax and Php

Using ajax to update a mysql database

Page 1 of 1

1 Replies - 817 Views - Last Post: 28 September 2010 - 08:02 AM Rate Topic: -----

#1 runthis  Icon User is offline

  • New D.I.C Head

Reputation: -9
  • View blog
  • Posts: 8
  • Joined: 26-September 10

Ajax and Php

Posted 28 September 2010 - 07:08 AM

Using ajax to update a mysql database

I have been pretty curios about this, any ideas.

This post has been edited by runthis: 28 September 2010 - 07:08 AM

Is This A Good Question/Topic? 0
  • +

Replies To: Ajax and Php

#2 Dannyboy997  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 64
  • View blog
  • Posts: 258
  • Joined: 17-April 09

Re: Ajax and Php

Posted 28 September 2010 - 08:02 AM

The best way would be to use JQuery for the ajax part.

Include the Jquery.js file between the
<head></head>
With this:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>


Now to update the database you just need to send a request to a php file with a jquery function.
$.ajax({
   type: "POST",
   url: "update.php",
   data: "name=hello&job=programming",
   success: function(msg){
     alert( "Data Saved: " + msg );
   }
 });



Now you create your update.php file and update the database as you would normally do.

Hope this Helps,
-Daniel
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1