SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2004
    Location
    york
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using JQuery to change database IDs

    Hi,

    I'm not as strong on JQuery as I'd like to be so hope this all makes sense but I'd appreciate some guidance on the best way to go about the following project.

    I'm working on a cms based website for writers and would like them to be able to reorder the chapters of a book. So, using php, they would be able to view the first 100 characters from each of the chapters they have written. Now what I'd like to do is for each of these chapters to be draggable with a jquery script and if they drop chapter 3 above chapter 2, the database will automatically be changed so that the chapter_id of 3 changes to 2 and all other chapters are incremented by 1.

    I'm not looking for a complete solution, just some general pointers on the best scripts or methodologies to research.

    Many thanks in advance for any tips.

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,339
    Mentioned
    179 Post(s)
    Tagged
    9 Thread(s)
    Hi there,

    This problem can be broken into two smaller ones:
    1. Make an element on a web page draggable using jQuery with an event firing when dragging stops
    2. Update a MySQL database using jQuery
    Point one:
    If you don't mind using plugins, I would recommend Draggable.
    Here's a demonstration of everything you need to accomplish the first part: http://jqueryui.com/draggable/#events

    Point two:
    jQuery is a client side JavaScript framework and doesn't have direct access to MySQL.
    Therefore you will need to look into pairing jQuery with PHP and MySQL.
    Here is a tutorial to get you started: http://technotip.com/2208/insert-dat...uery-ajax-php/

    HTH

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2004
    Location
    york
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Pullo,

    Apprciate you taking the time to reply with such useful info - I'll look into them.

    Many thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •