I have a table with the following structure,
FIELD TYPE EXTRA
faciltiy_id int auto_increment(Primary Key)
hotel_id int
facility_title varchar(20)
facility_desc varchar(300)
When I want to delete a row with a particular facility_id I use the code,
DELETE
FROM $hotel_facilities
WHERE facilities_id = '$facilities_id'";
But instead of the whole row, only the facility_title and facility_desc fields are getting deleted. If I run this query directly through phpmyadmin over the table it works correctly.
Can anyone enlighten me on what i am doing wrong?
Because the
facilities_idis an INT, you don’t need to enclose it within single quotes:But I think the real issue is that an UPDATE statement is being called, rather than the DELETE statement. Mainly because a DELETE statement only deletes entire rows, not specific columns.
You need to trace over what is being called when the submit is triggered, and print to screen (either using
echoor via Javascript if it’s more convenient) prior to execution.