shaunie Posted November 22, 2012 Share Posted November 22, 2012 Hi, I have an SQL statement something like the following DELETE FROM myTable WHERE id <>1 AND id <> 2 AND id <> 3 is it possible to get PHP to return an array of the id's that were deleted? mysql_affected_rows() only returns the number of rows deleted. Thanks Quote Link to comment Share on other sites More sharing options...
Barand Posted November 22, 2012 Share Posted November 22, 2012 Why would you need it to when you have specified which ids to delete? And I'd get your query correct before you worry about that. Quote Link to comment Share on other sites More sharing options...
shaunie Posted November 22, 2012 Author Share Posted November 22, 2012 Hi, Thanks for your reply, when building the query in PHP I know which ids not to delete, I just need to know if any have and which ones. Quote Link to comment Share on other sites More sharing options...
Barand Posted November 22, 2012 Share Posted November 22, 2012 (edited) That will teach my to put my glasses on!. You could do a SELECT query first to find out what would be deleted SELECT id FROM mytable WHERE id NOT IN (1,2,3); Edited November 22, 2012 by Barand Quote Link to comment Share on other sites More sharing options...
shaunie Posted November 22, 2012 Author Share Posted November 22, 2012 Didn't know I could do that way! Thanks for the advice Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted November 23, 2012 Share Posted November 23, 2012 Being a data junky, I don't like it when people actualy delete things. Is there a reason you can be sure that no one will ever want to refference that data again? Any way you could be convinced to archive rather than delete? Quote Link to comment 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.