JQuery drag and drop into mysql database?

I searched all over the web, I could only find inettuts-with-cookies, which tells how to use jQuery to perform drag and drop, and then save cookies. Can someone show me how to save the database (php and mysql)? I need it badly.

EDIT:

Firstly, I'm not a beginner of PHP, but an AJAX beginner. These tutorials are for 1 column only. Does anyone have drag and drop to a database for 2 or 3 columns? PLEASE →>

+4
source share
3 answers

This is pretty wide. My first reaction: go read the PHP beginner's book. In doing so, you need to find out the following:

Then try reading these comprehensive tutorials:

Update: It looks like you should send your data using JSON, which follows a structure similar to XML. Best to start with JSON.org . There are also tutorials on the jQuery site regarding their JSON functions for GET and POST.

As for updating multiple columns, you can either make multiple AJAX messages, or use PHP to break up the transferred data and simultaneously get into the database. This is my best guess based on the information you posted.

+2
source

Here are a few links to help you drag and drop: http://geekswithblogs.net/AzamSharp/archive/2008/02/21/119882.aspx http://www.codeproject.com/KB/webforms/JQueryPersistantDragDrop.aspx It's very simple but you need to write code based on your specific application.

In the onDrop method, you need to write an Ajax request for the POST data that you want to save. The JQuery AJAX API is here: http://docs.jquery.com/Ajax/jQuery.post#urldatacallbacktype

The POST URL must reference a PHP script that will save the data. On the PHP side, you are connecting to the database:

<?php $dbc = mysql_connect('localhost:/private/tmp/mysql.sock', 'root', 'password') or die (mysql_error()); mysql_select_db('database_name'); ?> 

Then you write the INSERT statement. This is the insertion expression for music shows:

 $sql_insert = "INSERT INTO shows (date,venue,venueLink,location,comment,time,dateOrder,locComment,confirm_by) VALUES ('".$Date."', '".$Venue."', '".$VenueLink."', '".$Location."', '".$Comment."', '".$Time."', '".$dateSort."', '".$locComment."', '".$confirmAll."')"; 

$ The venue, for example, will be a variable in your AJAX mail request. You can get these variables from superglobal PHP files:

 $Venue = $_POST['venue'] 

FYI: you can do this query much better because double quotes actually print variables ... I just copied and pasted some noob code that I found some time ago. You may worry about doing this quite late.

+2
source

All Articles