23 posts
  • Has been part of the Envato Community for over 5 years
  • Sells items exclusively on Envato Market
  • Located in 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
  • Has been part of the Envato Community for over 5 years
  • Sells items exclusively on Envato Market
  • Located in United Kingdom
enatom says

anyone …

960 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+4 more
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
  • Has been part of the Envato Community for over 5 years
  • Sells items exclusively on Envato Market
  • Located in 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.

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by