Guest User

Untitled

a guest
Jan 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. <?php
  2. if(is_array($arrData)
  3. {
  4.  foreach($arrData as $data)
  5.  {
  6.   $objCount = "";
  7.   $objCount = $this->Database->execute("SELECT count(id) AS counter FROM tl_table WHERE a=1 AND b=".$data[0]);
  8.   //b is unique key criteria to identify dataset
  9.                
  10.   if($objCount->counter > 0)
  11.    {
  12.     //destroy dublettes
  13.     $this->Database->execute("DELETE FROM tl_table WHERE a=1 AND b=".$data[0]);                                
  14.    }
  15.   //write to DB
  16.   $this->Database->execute("INSERT INTO tl_table (a,b,c) VALUES (1,'".$data[0]."',3)");
  17.  }
  18. }
  19. ?>
Add Comment
Please, Sign In to add comment