xyn Posted June 29, 2006 Share Posted June 29, 2006 Hi.I was wonering how to delete several items from a MYSQL Database using Check Box's. Say i had 1- messages. ID: 1,2,3,4,5,6,7,8,9 and 10. I wanted to delete id: 1,5,7. by ticking the box..How would I make this possible? Link to comment https://forums.phpfreaks.com/topic/13228-mysql-deleting-a-bulk/ Share on other sites More sharing options...
hvle Posted June 29, 2006 Share Posted June 29, 2006 make a list of check box with same name like this:<input type="checkbox" name="delete[]" value="$id">each check box has different value id.then after POST, if user check box 3,5,7, the $_POST['delete'] will be an array of value like this:$_POST['delete'][0] = 3;$_POST['delete'][1] = 5;$_POST['delete'][2] = 7;then simply retrieve these 3,5,7 and set up a query.something like this:"delete from table where id in (3,5,7)"; Link to comment https://forums.phpfreaks.com/topic/13228-mysql-deleting-a-bulk/#findComment-50921 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.