how to remove student_id from Marks table when delete Students row from student table

how to remove student_id from Marks table when delete Students row from student table

SarbastSarbast Posts: 36Questions: 0Answers: 0

Hello,

I have two tables as follow:
Table 1:- Students -> contain all info about students.
Table 2:- Marks-> contain students mark

I would like to remove student_id from Table 2 (Marks) when delete student row from Table 1 (Students).

Thanks

Replies

  • colincolin Posts: 12,617Questions: 0Answers: 2,156

    There are two way you can go.

    You could either do that in the server-side script, using events to update the second table directly.

    Or, you could do something similar on the client if both tables are present on the page. You would use submitSuccess to trigger the event, then use rows().every() to scan the rows in the second table, using row().data() to get the data to make sure they match, and if so, call remove() to delete from the server.

    Hope that helps, shout if you need a working example of the latter,

    Colin

  • SarbastSarbast Posts: 36Questions: 0Answers: 0

    Thanks alot colin

Sign In or Register to comment.