Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(is_array($arrData)
- {
- foreach($arrData as $data)
- {
- $objCount = "";
- $objCount = $this->Database->execute("SELECT count(id) AS counter FROM tl_table WHERE a=1 AND b=".$data[0]);
- //b is unique key criteria to identify dataset
- if($objCount->counter > 0)
- {
- //destroy dublettes
- $this->Database->execute("DELETE FROM tl_table WHERE a=1 AND b=".$data[0]);
- }
- //write to DB
- $this->Database->execute("INSERT INTO tl_table (a,b,c) VALUES (1,'".$data[0]."',3)");
- }
- }
- ?>
Add Comment
Please, Sign In to add comment