Purge from tables
A function to purge all rows where $key=$id in multiple tables
Usage
This function accepts an identifier ($id) as the first parameter and an array ($tbl_idx) as the second, $tbl_idx can be in two forms: array("mytable" => "myidcol") or array("mytable" => array("myidcol" => $id, "mysecondcol" => $id2); the first being used in instances where you want to delete all rows from mytable that have myidcol=$id, and the second being where you want to delete all rows from mytable where myidcol=$id and mysecondcol=$id2.
NOTE: this code currently just uses the last open mysql connection, it can be easily modified to use a differant one.

Comments