title: Inserting data two times in foreach loop with multiple arrays
body: <p>I have a working code </p>
  
  <pre><code>&lt;?php
  
  $con    =   mysql_connect('localhost','test','test');
  mysql_select_db('test',$con);
  
  
  require_once("xml2json.php");
  
  $testXmlFile = 'myxml.xml';
  
  $xmlStringContents = file_get_contents($testXmlFile); 
  $jsonContents = "";
  $jsonContents = xml2json::transformXmlStringToJson($xmlStringContents);
  $obj =json_decode($jsonContents);
  $rows = array();
  foreach($obj-&gt;rss-&gt;channel-&gt;item as $item) {
  
   $rows[] = "('".mysql_real_escape_string($item-&gt;title)."','".mysql_real_escape_string($item-&gt;description)."')";
  
   } 
          $del_horoscope = "delete from jos_horoscope";
          mysql_query($del_horoscope);
  
          $query = "INSERT INTO `jos_horoscope` (`title`,`description`) VALUES ".implode(', ',$rows);
          print_r ($query);
          mysql_query($query);
    // Do the query - do NOT show the output of mysql_error() in a production environment!
    if (!mysql_query($query)) echo 'Oh no! Something went wrong with the query: '.mysql_error();
  
  ?&gt;
  </code></pre>
  
  <p>But data is inserting twice with every run of this script. I am using delete statement to delete the data first before inserting new one.Can anyone please help me solve this twice problem. Here is teh screenshot of twice Data filled .<a href="http://i.imgur.com/7IM1mOE.png?1" rel="nofollow">http://i.imgur.com/7IM1mOE.png?1</a></p>
  
  <p>NEW EDIT</p>
  
  <p>Here is the INSERT QUERY echo <a href="http://pastebin.com/btZ7f85a" rel="nofollow">http://pastebin.com/btZ7f85a</a>
  The data is not duplicate.</p>
  
  <p>Thanks in advance</p>