Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Mysql onDelete cascade after table has been created

4 views
Skip to first unread message

apoorv....@gmail.com

unread,
Feb 20, 2016, 2:43:41 AM2/20/16
to
Hello I know we can use cascading while creating table but After I created table and there are bunch of data in it how would I do ondelete cascade.

I have a user table and a article table with one to many relationship and I have a foreign key user_id in article which refrences id in user table when I ran this query

ALTER TABLE `article`
FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE;

Now i Have foreign key but when I delete an entry in user table the corresponding entry in article does not get deleted.

Jerry Stuckle

unread,
Feb 20, 2016, 10:17:26 AM2/20/16
to
What does this have to do with PHP?

--
==================
Remove the "x" from my email address
Jerry Stuckle
jstu...@attglobal.net
==================
0 new messages