Manipulating "categories" in a mysql database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all,

 

This is more of a conceptional question rather then a technical one.

I am developping an online catalog, the catalog is a standard
categorie/subcat/subsubcat system using the following logic in my database:

 

cat_id   cat_name

10        DVD

1010     DVD/Action

1020     DVD/Adventure

20        CD

2010     CD/Reggae

2020     CD/Electro

 

Up to now I enter the category id's manually from an administration console.

I would like to be able to have my console automagically generate a cat_id
when my users add categories (so they don't have to bother with that aspect
of adding a category) and I would also like to be able to move a category up
or down in the way it displays on the page, as of now I am sorting by cat_id


 

I have been for a while trying to develop a logical scheme to be able to
generate the id's and change their cat_id to reflect a "new" position in how
it displays (displaying DVD/Action after DVD/Adventure for example I would
need to change the cat_id from 1010 to something above 1020 say 1021). This
is fine as I can test the previous elements cat_id and add or subtract 1 but
I get stuck when I have a cat_id say 1010 that I would want to put between
1011 and 1012. I'm having trouble developing the algorithm that would allow
this.. 

 

Would appreciate any "ideas" that may help me conclude this function in my
module.

 

Regards,

Tim Earl

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux