bmarinho Posted September 11, 2006 Share Posted September 11, 2006 Hi all,I got an issue in the week and i'm trying get some help to solve him.Well, the question is:I have a group of records in a table and the user need to pick some of them to be removed from de database. Some of the records cannot be removed cause they are required from other tables (FK's), so i need to validate them. I have autocommit on in the database configuration, but i tried do set him off just to use the "affected_rows" property after a DELETE and getting the number of rows affected. It keeps me returning null after the DELETE.How can i solve this question? If not what is the alternative?Thank you for the help.Bruno Marinho Quote Link to comment https://forums.phpfreaks.com/topic/20403-validate-mysql-delete/ Share on other sites More sharing options...
ober Posted September 11, 2006 Share Posted September 11, 2006 The easiest thing to do would be to setup a counter and check the result of the mysql_query() call as a indicator of whether a specific row was deleted. That would only work if you're deleting them one at a time. If you're deleting more than one at a time and "affected_rows" doesn't work, you could run a COUNT(*) query on the table before and after. Quote Link to comment https://forums.phpfreaks.com/topic/20403-validate-mysql-delete/#findComment-89896 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.