Sortable Elements PHP Class - Page 2

Back to page 1 | Back home page

To implement the PHP class in your code simply use the following ONE LINE:

$sorting = new Sortable_Elements("Friend", "tblFriends", "pkFriendID", "fldName", "fldSort");

The class takes 5 (five) parameters:

  1. The first is what each element in the table IS (for example, in this case, it's a table of friends). Make sure the parameter is the singular noun.
  2. The second parameter is the name of the table you are querying from.
  3. The third parameter is the primary key for each element in the table. (If this is in any way confusing, please reference database design elements for more information on the purposes of primary keys.)
  4. The forth parameter is the name of database field that you will be displaying/sorting/editing/adding/etc
  5. The final and fifth parameter is the name of the database field which is used for sorting.

Voila. You now have a functioning "sorting" application. Pretty nifty.

Click on the text/label for an element to turn it into a editable textbox. This allows you to actually edit the name of that item. For example, click the first name in the demo, Sean Dempsey. Change the name to whatever you want. Press enter. Instantly (and without page refresh) the database entry is changed.

Drag the order of the names up and down (grab the handle bar on the right). Click the "Save Sorting Order" button at the bottom. Your sorting preferences will be saved.

View demo again.

Download full demo

Previous Page

Your Rating      Overall Rating   

Comment on this Code

Your Name

Recent Comments

"The aelppts you describe simply download files to a directory and autoexecute a standard installer. The installer does the rest.For the ones you`ve seen that don`t have much or any user feedback, either the applet has used a Web form to retrieve the information needed in advance, or the installer just proceeds without user input." - Posted by Antonio on Tuesday Feb 21st, 2012 at 6:02am