23 posts
  • Exclusive Author
  • Has been a member for 4-5 years
  • United Kingdom
enatom says

Hi, guys. I’ve been looking all over the net for the following, but I can’t find anything mostly because the search term is saturated and difficult. Anyway.

I need to custom order records on a MySQL database. jQuery might make this really cool, but the core lesson, is how to custom order records.

For example, take these fields:- ID, title, content, order

ID will be auto-incrementing obviously. but I want “order” to be auto incrementing also as new posts are insterted into the table.

AND I need to be able to change the order of these records… for display purposes. (i.e to show some records before other ones).. so I can display the records by ORDER BY ‘order’ ASC or DESC .

I’m finding it difficult to work out how to do this. bearing in mind some records will get deleted. jQuery will make this a great tut also, I we can drag and drop records over and under each other to re-order them, which will change the ‘order’ fields of all the records. But any simpler take would be more appreciated.

I’ve emailed Jeffrey Way this, but I thought I’d write it here for others to see.

23 posts
  • Exclusive Author
  • Has been a member for 4-5 years
  • United Kingdom
enatom says

anyone …

960 posts
  • Bought between 10 and 49 items
  • Contributed a Tutorial to a Tuts+ Site
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 1 and 9 users
  • Sold between 10 000 and 50 000 dollars
  • United Kingdom
jeffeatworld says

Hey.

Try http://papermashup.com/drag-drop-with-php-jquery/ that’s a pretty simple take on it.

Otherwise, this might sound silly but why don’t you just have an “order” field on your database – the auto_id’s used are mearely for database reasons e.g. primary keys.

23 posts
  • Exclusive Author
  • Has been a member for 4-5 years
  • United Kingdom
enatom says

Thanks, Jeff, yeah I do have an order field. Besides, I have that side of things taken care of now, after a couple of days.

The rest will involve jQuery, which is where your link comes in handy.

Just what I was looking for. Thanks a lot!

EDIT : haven taken a quick skim through the link, its greater than what i expected and needed in the first place..

again thanks.

by
by
by
by
by
by