Deleting from multiple tables

wxdqz

New Member
Deleting from multiple tables

I have two tables. One table is called links. This table stores the url, name, description, and category of a href link. My other table is the categories table that stores all the categories that you can choose for the different links that you have in the links table. When I go to delete a category out of the categories table I want it to also delete all the links in the links table that have the same category as the category that I'm deleting from categories table. Right now I can delete a category from the categories table using this command "$sql = "DELETE FROM categories WHERE id=$id";" $id is the id of the record of the category I'm deleting. I want make it so it deletes all the links in the link table that have the same category as the one I'm deleting from the categories table.

Any help on this would be greatly appreciated!!!!!!
 
Back
Top