という名前のテーブルから PK に関連する 2 つの ID を取得する 2 つのフォーム ドロップダウンがありますnodes
。
という名前の別のテーブル内からこれら 2 つのノードを削除したいと考えていますrelationships
。
したがって、2 つのノード ID を収集した後、他のノードと関係がある 1 つのノードを削除しようとしています。
私の関係では、id
とgoingto
両方をノードとして持っていますid
が、FK だけで、もう 1 つはそうではありません。
では、それが関係にある場合、どうすればそれを削除できますか?
これが私の試みです
$goingto = $_POST['id_one']; //get from form both from id in nodes
$id = $_POST['idtwo']; //get from form both from id in nodes
mysql> DELETE from relationships where $id = $goingto;
これが私のテーブル構造です:
nodes relationships
----- -------------
id int(11), id int(11),
name varchar(35), goingto int(11), //this is the destinationnode from the id relation
color varchar(7), data varchar(0) null
type varchar (12), Foreign key (id) references nodes(id)
Primary key (id)
engine = innodb