update a field in another table when inserting record
Posted: 2011-09-09 08:30
Hi all,
I have two tables in a mysql db:
TABLE A (classroom)
id_cla [int(3)]
name_cla [varchar(255)]
seats_cla [int(3)]
max_seats_cla [int(3)]
TABLE B (students)
id_stu [int(3)]
name_stu [varchar(255)]
classroomid_stu [int(3)]
I have a form where the student will be able to subscribe to a classroom.
When the student will subscribe he will select the classroom from a dropdown menu.
Once he submits the form a record will be inserted in Table B, containing student name and the choosen classroom; at the same time the seats_cla in Table A should be updated/incremented (adding 1 to the actual field content).
Is there a way to do this with ADDT?
TIA for any help.
tony
I have two tables in a mysql db:
TABLE A (classroom)
id_cla [int(3)]
name_cla [varchar(255)]
seats_cla [int(3)]
max_seats_cla [int(3)]
TABLE B (students)
id_stu [int(3)]
name_stu [varchar(255)]
classroomid_stu [int(3)]
I have a form where the student will be able to subscribe to a classroom.
When the student will subscribe he will select the classroom from a dropdown menu.
Once he submits the form a record will be inserted in Table B, containing student name and the choosen classroom; at the same time the seats_cla in Table A should be updated/incremented (adding 1 to the actual field content).
Is there a way to do this with ADDT?
TIA for any help.
tony