Created
December 6, 2011 17:44
-
-
Save rlemon/1439130 to your computer and use it in GitHub Desktop.
updateItem method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function updateItem($id, $map, $groups) { | |
$this->updateData('inventory', $id, $map); // I update all the columns in the item table | |
$dbo = $this->db->exec('DELETE FROM group_item_mapping WHERE item_id = ' . $id); // here is where I remove the group enrollments. | |
for($i = 0, $l = count($groups); $i < $l; $i++) { | |
// here I re-add the enrollments for the selected checkbox options. | |
$this->addData('INSERT INTO group_item_mapping (item_id, group_id) VALUES (:item_id, :group_id)', array( ':item_id' => $id, ':group_id' => $groups[$i] )); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment