srpa01red 0 Newbie Poster

i had a table categories
category_id parent_id
industrial null
automotive null
petrol industrial
bikes automotive
diesel industrial
tankers automotive ....so on

ihad another table CATEGORY_PRODUCT with fields(category_id)
in this table i want to insert the category_id from category table as
if parent_id=null then insert category_id as parent_id
if parent_id !=null then insert category id as its parent_id
industrial and automotive are the parents of other categories.
plz help me soon.its urgent

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.