I have been trying to do this for weeks but i just cant figure this out. I have categories that have subcategories and i want to insert them into database. My table looks like this: cat_id, parent_id and cat_name.
Let's say i wanna insert a subcategory that is associated with its parent category.
If I understand your situatoin, I would create two tables: categories (category_id, category_name) subcategories (subcategory_id, category_id, subcategory_name)
Then, in your PHP script, have the user select the category and enter the subcategory name. The SQL INSERT would then be
INSERT INTO subcategories (category_id, subcategory_name) VALUES ($cat_id, '$subcat_name');
Larry
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php