Hello, I'm trying to get some clarification on creating a better "Category" system for my site. The one I have created and tested, doesn't go so smoothly when trying to delete data. It simply has a table with an ID, Name, and Parent and each Links( parent=0), (sub-cat)Favorites(parent=links), (sub-cat of favorites)digg(parent=favorites). When I was working with the deleting process I decided, enough is enough. This is a crappy design. So I came across a very old thread and seen this one guys idea but didn't see any examples.
What I need is some help that will create something in my 'categories' table like so:
id | node | cat_name
----+----------+--------------
9 | 009 | Parent
10 | 010 | Another Parent
11 | 009011 | Sub Cat
13 | 010013 | Sub Cat 2
12 | 010012 | Sub Cat 3
Where as Sub Cat is a child of Parent(9) and Sub cat2 and 3 are child of Another Parent(10)
How would I go about INSERTing this sort of data as 9 = 009 and if it gets to the point of doubling such as 10 it would insert as 010, etc, since the ID field will be auto_increment as well. Pretty much , having 3 digits giving me 999 options for each Category
I understand the whole deleting part and somewhat reading part (if someone feels like giving a quick run-down on that also it would help) which is pretty simple I would simply run a query like so,
DELETE FROM categories WHERE node LIKE '009%'
Any help would be greatly appreciated. Thanks much!