Jump to content

urgent help ordering database rows in php


busby

Recommended Posts

ok will try be as clear as possible :)

 

i have a small web app where a user can create a shopping list, populate it with categories..and populate categories with items...so for example...they make a list called tescos...they create 3 categories (frozen food, fruit and veg, electronics)...they then create items under each of those categories (burgers, apples, DVD's)

 

they can edit, delete and add new lists, categories and items.#

 

however i need them ALSO to be able to order the categories...so they could arrange them in the order they will appear in the shop...so i DONT mean order by category ascending or descending...i mean move a category up or down a position in the list...maybe have an up and down arrow next to each category.

 

i know i need a field in my database called for example...cat_order

 

but how do i populate this field when the user creates a new category? i cant have it auto increment because i already have the ID field do that...so when a user creates a new category i dont know how to populate this order field.

 

now once i do manage to get the order field populated how would i do this ordering?

 

could i have code please? ive spent a LONG time on this and i cant do it...its very urgent i need it working by tomorrow morning.

 

So my category tables looks like:

 

catid --- category --- listid --- catorder

1 ---------Frozen ----- 2 --------- ???

 

please hurry and thanks in advance

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.