Answer the question
In order to leave comments, you need to log in
How to properly set up cascading deletion?
Hello. There are three tables:
Table links main
I get id. It is necessary to delete all records from links, where the telegramID = id field and all related data from the plants table. Tried via cascade delete like so:
alter table links add constraint auto_del
foreign key (id)
references plants(id) on delete cascade;
Answer the question
In order to leave comments, you need to log in
$str = '1502_0,1510_1,628_2,5293_3,6650_4,5308_5,3187_6,3207_7';
$list = explode(',', $str);
$i = 0;
foreach ($list as $item) {
$data = explode('_', $item);
$arr[$i] = $data;
$i++;
}
print_r($arr);
alter table links add constraint auto_del
foreign key (id)
references plants(id) on delete cascade;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question