{"id":2126,"date":"2009-09-30T17:05:23","date_gmt":"2009-09-30T21:05:23","guid":{"rendered":"http:\/\/teamtutorials.com\/?p=2126"},"modified":"2014-12-05T12:38:20","modified_gmt":"2014-12-05T17:38:20","slug":"using-jquery-to-reorder-a-list-and-update-a-database","status":"publish","type":"post","link":"https:\/\/teamtutorials.com\/web-development-tutorials\/using-jquery-to-reorder-a-list-and-update-a-database","title":{"rendered":"Using jQuery to Reorder a List and Update a Database"},"content":{"rendered":"
\n

You should not use this code on a production website.<\/h4>\n

Warning:<\/strong> This tutorial uses old techniques. It is insecure and will leave your server vulnerable to SQL Injection attacks<\/strong>.This tutorials also uses mysql_ functions that are no longer support. For updated tutorials look for a PDO<\/a> or MySQLi tutorial.This post will be delete or revised in the future.<\/p>\n<\/div>\n

This tutorial will show you how to use jQuery to allow as list (UL) to be reordered and will also make an AJAX call to a PHP file that will update the database when an item is dropped. I found this useful for a project I was working on recently. The user wanted to be able to change the order that categories displayed in a report. The items are stored in a database with a field called display_order. When the report is generated we simply order by that field.<\/p>\n

This tutorial requires:<\/strong><\/p>\n