February 21, 201214 yr I have taken over a meeting booking system at my place of work and I am stuck with the mysql/php code for a cancelation button on the review bookings page. The database itself has to remain how it was from the previous guy in charge. The problem I have is that the "request_id" field appears in 3 seperate tables. As I have only limited php/mysql experience I am finding it hard to get working. Any help would be appreciated... Database Details Table Name: facility_request Field 1: facility_id Field 2: request_id Table Name: week_request Field 1: week_id Field 2: request_id Table Name: request Field 1: request_id Field 2: department_code Field 3: building_id Field 4: room_id Field 5: capacity Field 6: start_time Field 7: day Field 8: other_req Field 9: no_room There is a review page for the booking system and I need to allow users to remove there booking. I have a cancel button but I dont know how to delete the meeting from all three tables at the same time. This is about as far as I can get by myself at the moment. Using php to fetch the request_id for each booked meeting. DELETE * FROM `request` WHERE request_id =1 Again, any help would be massivly appreciated. Kind Regards, James Taylor
March 17, 201214 yr I have taken over a meeting booking system at my place of work and I am stuck with the mysql/php code for a cancelation button on the review bookings page. The database itself has to remain how it was from the previous guy in charge. The problem I have is that the "request_id" field appears in 3 seperate tables. As I have only limited php/mysql experience I am finding it hard to get working. Any help would be appreciated... Database Details Table Name: facility_request Field 1: facility_id Field 2: request_id Table Name: week_request Field 1: week_id Field 2: request_id Table Name: request Field 1: request_id Field 2: department_code Field 3: building_id Field 4: room_id Field 5: capacity Field 6: start_time Field 7: day Field 8: other_req Field 9: no_room There is a review page for the booking system and I need to allow users to remove there booking. I have a cancel button but I dont know how to delete the meeting from all three tables at the same time. This is about as far as I can get by myself at the moment. Using php to fetch the request_id for each booked meeting. DELETE * FROM `request` WHERE request_id =1 Again, any help would be massivly appreciated. Kind Regards, James Taylor Try DELETE facility_request,week_request,request FROM request LEFT JOIN week_request ON request.request_id = week_request.request_id LEFT JOIN facility_request ON week_request.request_id = facility_request.request_id WHERE request.request_id = $request_id
Create an account or sign in to comment