コード例 #1
0
 public function import($table, $fileName)
 {
     parent::__construct($fileName);
     $qwery = " ";
     $j = 1;
     for ($i = 1; $i < parent::getNumRows(); $i++) {
         $qwery = "INSERT INTO `mail_data`(`comp_name`, `email`, `phone`, `adres`, `called`, `sended`, `coments`) \n\t\t\tVALUES (";
         while (parent::issetCell($i, $j)) {
             $item = parent::getCellValue($i, $j);
             if ($j == 1) {
                 $qwery = $qwery . "'" . $this->mysqli->real_escape_string($item) . "'";
             } else {
                 $qwery = $qwery . ",'" . $this->mysqli->real_escape_string($item) . "'";
             }
             $j++;
         }
         $qwery = $qwery . ", '0', '0', NULL)";
         $result = $this->mysqli->query($qwery);
         if ($result === false) {
             echo 'Nie można było wykonać zapytania z powodu błędu: ' . $this->mysqli->error;
             exit(1);
         }
         $j = 1;
     }
     return true;
 }
コード例 #2
0
ファイル: Tsv.php プロジェクト: FluentDevelopment/piwik
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     $this->setSeparator("\t");
 }
コード例 #3
0
ファイル: Zip.php プロジェクト: kidaa30/magento2-platformsh
 /**
  * @param string $file
  * @param \Magento\Framework\Filesystem\Directory\Write $directory
  * @param string $options
  */
 public function __construct($file, \Magento\Framework\Filesystem\Directory\Write $directory, $options)
 {
     $zip = new \Magento\Framework\Archive\Zip();
     $file = $zip->unpack($directory->getRelativePath($file), $directory->getRelativePath(preg_replace('/\\.zip$/i', '.csv', $file)));
     parent::__construct($file, $directory, $options);
 }