how can i delete a record from multiple tables

Iam having category id in category table,and in orders table.If iam deleting in that id in category table at a time it should delete in orders table also how can i do this can anyone help me.

Thanks in advance

Re: Deleting a record from multiple tables 80 80

You could use foreign keys constraints:

If you have doubts, show us the tables schema.

Re: Deleting a record from multiple tables 80 80
Member Avatar

See cereal's link and pay attention to CASCADE. This won't work automatically unless you have set up FKs - perhaps that's obvious?

Be a part of the DaniWeb community

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