title: PHP read csv and load it into postgres with PDO
body: <p>I have <code>.csv</code> file with 9k rows. When I use script from <code>php manual</code> :</p>
  
  <pre><code>&lt;?php
  $row = 1;
  if (($handle = fopen("test.csv", "r")) !== FALSE) {
      while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {
          $num = count($data);
          echo "&lt;p&gt; $num fields in line $row: &lt;br /&gt;&lt;/p&gt;\n";
          $row++;
          for ($c=0; $c &lt; $num; $c++) {
              echo $data[$c] . "&lt;br /&gt;\n";
          }
      }
      fclose($handle);
  }
  ?&gt;
  </code></pre>
  
  <p>I got on my <code>output</code> everysingle cell from the <code>csv</code> file.</p>
  
  <p>Problem occurs when I want to treat every row as record create object from it and store it into database. I have modified it like:</p>
  
  <pre><code>if (($handle = fopen("test.csv", "r")) !== FALSE) {
      while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {
          $num = count($data);
  
          $record= new Record($db);
          echo "&lt;p&gt; $num fields in line $row: &lt;br /&gt;&lt;/p&gt;\n";
          $row++;
          for ($c=0; $c &lt; $num; $c++) {
                  $record-&gt;$attributes[$c] =  utf8_encode($data[$c]);
          }
      $record-&gt;Store();
      }
      fclose($handle);
  }
  </code></pre>
  
  <p>In this case only about 2k records are store into mine <code>PostgreSQL</code> database, but no exception or error is shown. I have no idea why my loop stops. Everytime i run the script it loads into mine database different amount of records between 1,6k and 2,1k.</p>
  
  <p>I have no limits set on my <code>PostgreSQL</code> (At least i don't knew of any..)</p>
  
  <p>Can anyone explain me what am I doing wrong?</p>