I want to delete “several row mysql database” together after select with checkbox in “codeigniter”, but my function not work:(my problem is in “function delete()”). What is it?
function delete(){
$delete = $this->input->post('delete'); // this is array => "delete[]" . value this is "id" it row in database.
for($i=0;$i<count($delete);$i++) {
$this->db->delete('My_Table', array('id' => $delete[$i]));
}
}
Once you have an array of ID’s in your
$deletevariable, you can do the following: