delet only child in related table

delet only child in related table

rrzavaletarrzavaleta Posts: 78Questions: 52Answers: 2

I have two tables in mysql (T1 = safe ) and (T2 = customers) .related table
The table is related to T2 to T1 where , where ID_ASEGURADORA (T1 father) field data are received in ID_ASEGURADORA T2 (T2 SON )

The following step .
When I want to delete using the fashion of :
http://localhost/DataTables-1.10.4/DataTables-1.10.4/extensions/Editor-1.3.3/examples/simple/inTableControls.html

Visually I delete only one child ( mysql t2 ) , but after cool completely delete the contents of ID_ASEGURADORA found in the ( T2). Ie instead of deleting only one child table 'm deleting a father and all his sons ( this happens in T2). As I can fix this. I'm using the same example.

$('#example').on('click', 'a.editor_remove', function (e) {
e.preventDefault();
editor
.message( '¿Are you sure you wish to remove this record?' )
.buttons( { "label": "Delete", "fn": function () { editor.submit() } } )
.remove( $(this).closest('tr') );
} );

Answers

  • allanallan Posts: 61,757Questions: 1Answers: 10,111 Site admin

    Which table is shown in the HTML, T1 or T2? If it is T1, then yes, deleting a row will actually delete a row from the T1 database table. If T2, then I don't understand why it would be touching T1 at all.

    Are you able to link me to the page so I can take a look and understand what is happening please?

    Allan

This discussion has been closed.