当前位置: 首页>>代码示例>>PHP>>正文


PHP Spreadsheet_Excel_Reader::rowcount方法代码示例

本文整理汇总了PHP中Spreadsheet_Excel_Reader::rowcount方法的典型用法代码示例。如果您正苦于以下问题:PHP Spreadsheet_Excel_Reader::rowcount方法的具体用法?PHP Spreadsheet_Excel_Reader::rowcount怎么用?PHP Spreadsheet_Excel_Reader::rowcount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Spreadsheet_Excel_Reader的用法示例。


在下文中一共展示了Spreadsheet_Excel_Reader::rowcount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: import

 public function import($file)
 {
     try {
         $users = array();
         $params = array(1 => 'user_name', 'user_password', 'user_first_name', 'user_last_name', 'user_email', 'user_group', 'user_vhost');
         $excel = new Spreadsheet_Excel_Reader($file);
         $rows = $excel->rowcount($sheet_index = 0);
         $cols = $excel->colcount($sheet_index = 0);
         for ($row = 2; $row <= $rows; $row++) {
             if ($cols == 7) {
                 for ($col = 1; $col <= $cols; $col++) {
                     $users[$row][$params[$col]] = $excel->val($row, $col);
                     $users[$row]['user_vhost'] = explode(',', $excel->val($row, 7));
                     $users[$row]['user_group'] = '';
                 }
             }
         }
         $this->userimport = new userimport();
         $users = $this->userimport->import($users);
         $_SESSION['message'] = $this->userimport->get_message();
         return $users;
     } catch (Exception $e) {
         display_page_error();
     }
 }
开发者ID:jabouzi,项目名称:projet,代码行数:25,代码来源:xlsimportadapter.php

示例2: importsiswa

 public function importsiswa()
 {
     require_once 'application/controllers/base/excel_reader2.php';
     echo '<html><head><title>Loading...</title></head><body></body></html>';
     $xls = $_FILES['data-import'];
     if (!empty($_FILES['data-import']['name'])) {
         $this->load->library('upload');
         //load upload lobrary
         $xls_name = str_replace(' ', '_', $xls['name']);
         $config['upload_path'] = './assets/xls/';
         $config['allowed_types'] = '*';
         $config['max_size'] = '2000000';
         //2MB
         $config['overwrite'] = true;
         $this->upload->initialize($config);
         if (!$this->upload->do_upload('data-import')) {
             //Upload Failed
             echo $this->upload->display_errors();
         } else {
             //Upload Complete
             $siswa = new Spreadsheet_Excel_Reader('./assets/xls/' . $xls_name);
             $rows = $siswa->rowcount(0);
             // echo $rows;
             //looping to insert database
             for ($i = 2; $i < $rows; $i++) {
                 $nis = $siswa->val($i, 1, 0);
                 //baris ke $i, kolom 1, sheet 1
                 $angkatan = $siswa->val($i, 2, 0);
                 $nama = $siswa->val($i, 3, 0);
                 $subkelas1 = $siswa->val($i, 4, 0);
                 $subkelas2 = $siswa->val($i, 5, 0);
                 $subkelas3 = $siswa->val($i, 6, 0);
                 if (empty($subkelas1)) {
                     $subkelas1 = null;
                 }
                 if (empty($subkelas2)) {
                     $subkelas2 = null;
                 }
                 if (empty($subkelas3)) {
                     $subkelas3 = null;
                 }
                 $status = $siswa->val($i, 7, 0);
                 $kelamin = $siswa->val($i, 8, 0);
                 $password = md5($nis);
                 $data = array('nis' => $nis, 'angkatan' => $angkatan, 'nama_lengkap' => $nama, 'subkelas1' => $subkelas1, 'subkelas2' => $subkelas2, 'subkelas3' => $subkelas3, 'status' => $status, 'password' => $password, 'kelamin' => $kelamin);
                 // echo '<br/>';
                 // print_r($data);
                 //insert to table
                 $this->db->insert('siswa', $data);
             }
             echo 'Berhasil Import Data Siswa <a href="' . site_url("admin/siswa") . '">kembali</a>';
         }
     } else {
         echo 'XLS Not Found!';
     }
 }
开发者ID:eandriyas,项目名称:SMAN-01-Depok-Babarsari-Sosial-Version-1.0,代码行数:56,代码来源:admin.php

示例3: FetchContacts

 public function FetchContacts($credential = null)
 {
     $filename = OPENBIZ_APP_PATH . $this->_data['file'];
     $data = new Spreadsheet_Excel_Reader($filename);
     $results = array();
     $row_num = $data->rowcount();
     if ($row_num >= 3) {
         for ($i = 3; $i <= $row_num; $i++) {
             $results[] = $this->RowtoContact($data, $i);
         }
     }
     unlink($filename);
     return $results;
 }
开发者ID:openbizx,项目名称:openbizx-cubix,代码行数:14,代码来源:ContactService.php

示例4: data_excel

/**
 * Method untuk membaca data pada file excel
 *
 * @param  string  $path_file           path file excel
 * @param  integer $baris_mulai_data
 * @return array
 */
function data_excel($path_file, $baris_mulai_data = 2)
{
    include 'excel_reader2.php';
    $file_excel = new Spreadsheet_Excel_Reader($path_file);
    # membaca jumlah baris dari data excel
    $baris = $file_excel->rowcount($sheet_index = 0);
    $kolom = $file_excel->colcount($sheet_index = 0);
    $data_return = array();
    for ($i = $baris_mulai_data; $i <= $baris; $i++) {
        $row_data = array();
        for ($k = 1; $k <= $kolom; $k++) {
            $row_data[] = $file_excel->val($i, $k);
        }
        $data_return[] = $row_data;
    }
    return $data_return;
}
开发者ID:pancamedia,项目名称:Marlina-Sabil,代码行数:24,代码来源:helper.php

示例5: proses

 function proses()
 {
     require 'excel_reader.php';
     if (isset($_POST['submit'])) {
         $target = basename($_FILES['filepegawaiall']['name']);
         move_uploaded_file($_FILES['filepegawaiall']['tmp_name'], $target);
         $data = new Spreadsheet_Excel_Reader($_FILES['filepegawaiall']['name'], false);
         //    menghitung jumlah baris file xls
         $baris = $data->rowcount($sheet_index = 0);
         //    jika kosongkan data dicentang jalankan kode berikut
         if ($_POST['drop'] == 1) {
             //             kosongkan tabel pegawai
             $truncate = "TRUNCATE TABLE pegawai";
             $this->db->query($truncate);
         }
         //    import data excel mulai baris ke-2 (karena tabel xls ada header pada baris 1)
         for ($i = 2; $i <= $baris; $i++) {
             //       membaca data (kolom ke-1 sd terakhir)
             $nama = $data->val($i, 1);
             $tempat_lahir = $data->val($i, 2);
             $tanggal_lahir = $data->val($i, 3);
             echo $nama;
             echo " ";
             echo $tempat_lahir;
             echo " ";
             echo $tanggal_lahir;
             echo " ";
             echo "<br>";
             // setelah data dibaca, masukkan ke tabel pegawai sql
             // $query = "INSERT into pegawai (nama,tempat_lahir,tanggal_lahir)values('$nama','$tempat_lahir','$tanggal_lahir')";
             // $hasil = $this->db->query($query);
         }
         // if(!$hasil){
         //          jika import gagal
         // die(mysql_error());
         // }else{
         //          jika impor berhasil
         // echo "Data berhasil diimpor.";
         // }
         //    hapus file xls yang udah dibaca
         unlink($_FILES['filepegawaiall']['name']);
     }
 }
开发者ID:ahmadsm,项目名称:kuisonline,代码行数:43,代码来源:Upload.php

示例6: import

 public function import($file)
 {
     try {
         $users = array();
         $params = array(1 => 'username', 'password', 'first_name', 'last_name', 'email', 'admin', 'active');
         $excel = new Spreadsheet_Excel_Reader($file);
         $rows = $excel->rowcount($sheet_index = 0);
         $cols = $excel->colcount($sheet_index = 0);
         for ($row = 2; $row <= $rows; $row++) {
             for ($col = 1; $col <= $cols; $col++) {
                 $users[$row][$params[$col]] = $excel->val($row, $col);
             }
         }
         $this->userimport = new userimport();
         $users = $this->userimport->import($users);
         $_SESSION['message'] = $this->userimport->get_message();
         return $users;
     } catch (Exception $e) {
         display_page_error();
     }
 }
开发者ID:jabouzi,项目名称:usermanager,代码行数:21,代码来源:xlsimportadapter.php

示例7: importToExistingTable

function importToExistingTable($file, $tableName)
{
    $data = new Spreadsheet_Excel_Reader($file);
    $colcount = $data->colcount();
    $rowcount = $data->rowcount();
    //This gets the field names in the database so that they can be confirmed as matching those in the spreadsheet:
    $sql = mysql_query("SELECT * FROM `{$tableName}`");
    for ($no = 0; $no <= $colcount; $no++) {
        $tableColsArray[$no] = mysql_field_name($sql, $no);
    }
    //This goes through the spreadsheet and compares the columns with those in the database:
    for ($colno = 1; $colno <= $colcount; $colno++) {
        $cell = $data->value(1, $colno);
        if ($tableColsArray[$colno] != $cell) {
            die("Column {$colno} does not match its counterpart in the database");
        } else {
            echo "spreadsheet part ({$cell}) perfectly matches db part ({$tableColsArray[$colno]})<br />";
        }
    }
    //This goes through the whole sheet building the insert statement from the data:
    $actualInserts = 0;
    for ($rowno = 2; $rowno <= $rowcount; $rowno++) {
        $sql = "INSERT INTO `{$tableName}` (";
        for ($no = 1; $no < count($tableColsArray); $no++) {
            $sql = $sql . "`{$tableColsArray[$no]}`,";
        }
        $sql = substr($sql, 0, -1) . ") VALUES (";
        for ($colno = 1; $colno <= $colcount; $colno++) {
            $sql = $sql . "'" . mysql_real_escape_string($data->value($rowno, $colno)) . "',";
        }
        $sql = substr($sql, 0, -1) . ")";
        //This executes the insert and counts the successful inserts:
        if (!mysql_query($sql)) {
            echo mysql_error();
        } else {
            $actualInserts++;
        }
    }
    echo "<br />" . $actualInserts . " rows inserted";
}
开发者ID:silasslack,项目名称:php-excel-reader,代码行数:40,代码来源:dataImport.php

示例8: elseif

             $error = 'Failed to write file to disk';
             break;
         case '8':
             $error = 'File upload stopped by extension';
             break;
         case '999':
         default:
             $error = 'No error code avaiable';
     }
 } elseif (empty($_FILES[$element]['tmp_name']) || $_FILES[$element]['tmp_name'] == 'none') {
     $error = 'No file was uploaded..';
 } else {
     $filename = $_FILES[$element]['tmp_name'];
     //echo $filename."f";
     $data = new Spreadsheet_Excel_Reader($filename);
     $r = $data->rowcount($sheet_index = 0);
     $i = 0;
     echo $r;
     while (1 != $r) {
         mysql_query("INSERT INTO `task_detail`\r\n\t\t\t\t\t\t\t  (`task_id`, `user_id`,  `status`, `person_n`, `first_name`, `last_name`, `person_status`,`phone`, `mail`, `addres`, `city_id`, `family_id`, `b_day`, `profesion`)\r\n\t\t\t\t\t\t\t    VALUES ( '" . $_REQUEST['task_id'] . "', '" . $_SESSION['USERID'] . "', '1',\r\n\t\t\t\t\t\t\t\t\t\t '" . $data->val($r, 'A') . "', '" . $data->val($r, 'B') . "',\r\n\t\t\t\t\t\t\t\t\t \t '" . $data->val($r, 'C') . "', '" . $data->val($r, 'D') . "',\r\n\t\t\t\t\t\t\t\t\t \t '" . $data->val($r, 'E') . "', '" . $data->val($r, 'F') . "',\r\n\t\t\t\t\t\t\t\t\t \t '" . $data->val($r, 'G') . "', '" . $data->val($r, 'H') . "',\r\n\t\t\t\t\t\t\t\t\t \t '" . $data->val($r, 'I') . "', '" . $data->val($r, 'J') . "',\r\n\t\t\t\t\t\t\t\t\t \t '" . $data->val($r, 'K') . "')") or die(err);
         $r--;
         //return 0;
     }
     echo "xls File has been successfully Imported";
     if (file_exists($path)) {
         unlink($path);
     }
     //			move_uploaded_file ( $_FILES [$element] ['tmp_name'], $path);
     //
     // for security reason, we force to remove all uploaded file
     //			@unlink ( $_FILES [$element] );
开发者ID:GeoPvN,项目名称:epro,代码行数:31,代码来源:import.php

示例9: mPDF

<?php

if (isset($_GET['email'])) {
    $email = $_GET['email'];
}
require_once 'lib/excel_reader2.php';
define('MPDF_PATH', 'lib/mpdf');
include MPDF_PATH . '/mpdf.php';
require_once 'lib/mpdf/mpdf.php';
$excel = new Spreadsheet_Excel_Reader('docs/participantes.xls');
$mpdf = new mPDF('utf-8', 'A4-L', 0, '', 0, 0, 3, 0, 0, 0);
$certificate = array();
$date = getdate();
$count = $excel->rowcount();
for ($i = 0; $i < $count + 1; $i++) {
    $current_email = $excel->val($i, 3);
    if ($current_email == $email) {
        $first_name = $excel->val($i, 1);
        $last_name = $excel->val($i, 2);
        $certificate['name'] = utf8_encode($first_name . ' ' . $last_name);
        $certificate['type'] = $excel->val($i, 4);
        break;
    }
}
$html = '<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8">
	<title>Certificado - WordCamp RJ 2015</title>
	<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic">
	<link rel="stylesheet" href="css/certificate.css">
</head>
<body>';
if (!empty($email) && filter_var($email, FILTER_VALIDATE_EMAIL)) {
开发者ID:ruda-almeida,项目名称:wp-rio,代码行数:31,代码来源:certificate.php

示例10: array

<div class="row">
	<div class="col-md-12">
		<div class="box-header">
            <h3 class="box-title">Kết quả Import Excel</h3>
        </div><!-- /.box-header -->
<?php 
$arrColumn = array('product_code', 'product_name', 'cate_type_id', 'cate_id', 'trangthai', 'price', 'price_saleoff', 'deal_amount', 'start_date', 'end_date', 'da_ban', 'meta_title', 'meta_description', 'meta_keyword');
require_once 'controller/ExcelReader.php';
$dataArr = array();
if ($_FILES['file']['tmp_name']) {
    $data = new Spreadsheet_Excel_Reader($_FILES['file']['tmp_name'], true, "UTF-8");
    $numCol = $data->colcount();
    $rowCol = $data->rowcount();
    for ($j = 1; $j <= $numCol; $j++) {
        for ($i = 2; $i <= $rowCol; $i++) {
            $dataArr[$arrColumn[$j - 1]][] = $data->val($i, $j);
        }
    }
}
if (!empty($dataArr)) {
    $count = count($dataArr['product_code']);
    for ($k = 0; $k <= $count; $k++) {
        foreach ($arrColumn as $value) {
            $dataInsert[$value] = $dataArr[$value][$k];
            $dataInsert['name_en'] = $model->stripUnicode($dataArr['product_name'][$k]);
            $dataInsert['product_alias'] = $model->changeTitle($dataArr['product_name'][$k]);
            $id = $model->getProductIdByCode($dataArr['product_code'][$k]);
            if ($id > 0) {
                $dataInsert['id'] = $id;
            }
        }
开发者ID:hoangnhonline,项目名称:vinawatch,代码行数:31,代码来源:save.php

示例11: clean

<?php

$xls = new Spreadsheet_Excel_Reader($uploaded_file, false);
$baris = $xls->rowcount($sheet_index = 0);
$x_tgl_bayar_bank = clean($xls->val(2, 2));
$spl = explode('-', $x_tgl_bayar_bank);
if (count($spl) != 3 || !checkdate($spl[1], $spl[0], $spl[2])) {
    echo '<tr><td colspan="14">Error. Format tanggal tidak valid. ' . $x_tgl_bayar_bank . '</td></tr>';
    exit;
}
$tbb = $spl[0] . '-' . $spl[1] . '-' . $spl[2] . ' 00:00:00';
# LIST KODE_BLOK
$q_kode_blok = array();
for ($ix = 4; $ix <= $baris; $ix++) {
    $x_kode_blok = (string) clean($xls->val($ix, 2));
    if ($x_kode_blok != "") {
        $q_kode_blok[] = $x_kode_blok;
    }
}
# LIST NO_PELANGGAN
$in_q_kode_blok = implode("', '", $q_kode_blok);
$query = "\nSELECT \n\tKODE_BLOK, NO_PELANGGAN\nFROM\n\tKWT_PELANGGAN \nWHERE\n\tKODE_BLOK IN ('{$in_q_kode_blok}') \n";
$q_np = array();
$obj = $conn->Execute($query);
while (!$obj->EOF) {
    $q_kb = $obj->fields['KODE_BLOK'];
    $q_np["{$q_kb}"] = $obj->fields['NO_PELANGGAN'];
    $obj->movenext();
}
# GET VALUES
for ($ix = 4; $ix <= $baris; $ix++) {
开发者ID:rizafr,项目名称:market_ancol,代码行数:31,代码来源:data_bumiputera.php

示例12: parse_import_file_xls

 /**
  * Parses xls import file
  *
  * @access private
  * @param object $subnet
  * @param array $custom_address_fields
  * @return mixed
  */
 private function parse_import_file_xls($subnet, $custom_address_fields)
 {
     # get excel object
     require_once dirname(__FILE__) . '/../../functions/php-excel-reader/excel_reader2.php';
     //excel reader 2.21
     $data = new Spreadsheet_Excel_Reader(dirname(__FILE__) . '/../../app/subnets/import-subnet/upload/import.xls', false);
     //get number of rows
     $numRows = $data->rowcount(0);
     $numRows++;
     $outFile = array();
     //get all to array!
     for ($m = 0; $m < $numRows; $m++) {
         //IP must be present!
         if (filter_var($data->val($m, 'A'), FILTER_VALIDATE_IP)) {
             //for multicast
             if ($this->settings - enableMulticast == "1") {
                 if (strlen($data->val($m, 'F')) == 0 && $this->Subnets->is_multicast($data->val($m, 'A'))) {
                     $mac = $this->Subnets->create_multicast_mac($data->val($m, 'A'));
                 } else {
                     $mac = $data->val($m, 'F');
                 }
             }
             $outFile[$m] = $data->val($m, 'A') . ',' . $data->val($m, 'B') . ',' . $data->val($m, 'C') . ',' . $data->val($m, 'D') . ',';
             $outFile[$m] .= $data->val($m, 'E') . ',' . $mac . ',' . $data->val($m, 'G') . ',' . $data->val($m, 'H') . ',';
             $outFile[$m] .= $data->val($m, 'I') . ',' . $data->val($m, 'J');
             //add custom fields
             if (sizeof($custom_address_fields) > 0) {
                 $currLett = "K";
                 foreach ($custom_address_fields as $field) {
                     $outFile[$m] .= "," . $data->val($m, $currLett++);
                 }
             }
         }
     }
     // return
     return $outFile;
 }
开发者ID:routenull0,项目名称:phpipam,代码行数:45,代码来源:class.Tools.php

示例13: importexcel

 public function importexcel()
 {
     $fileupload = $_FILES['fileexcel']['tmp_name'];
     $namafile = $_FILES['fileexcel']['name'];
     $path = 'assets/resources/data/';
     $pathfile = $path . $namafile;
     $orgid = $this->my_usession->userdata('user_dept') != '' ? $this->employe_model->deptonall(explode(',', $this->my_usession->userdata('user_dept'))) : array();
     $holiday = $this->roster_model->holiday($orgid);
     $holarray = array();
     foreach ($holiday->result() as $hol) {
         $tglmulai = strtotime($hol->startdate);
         $tglselesai = strtotime($hol->enddate);
         $selisih = $tglselesai - $tglmulai;
         if ($selisih == 0) {
             $holarray[] = $hol->startdate;
         } else {
             $jarak = $selisih / 86400;
             for ($k = 0; $k <= $jarak; $k++) {
                 $holarray[] = date('Y-m-d', strtotime($hol->startdate) + $k * 86400);
             }
         }
     }
     if (move_uploaded_file($fileupload, $pathfile)) {
         include_once APPPATH . "libraries/excelreader.php";
         $data = new Spreadsheet_Excel_Reader($pathfile);
         $blth = $data->val(2, 2) . '-' . date('m', strtotime($data->val(1, 2)));
         $usernik = $this->roster_model->getuseridfromnik();
         foreach ($usernik->result() as $useridfromnik) {
             $array[$useridfromnik->userid] = array('name' => $useridfromnik->name, 'group' => $useridfromnik->deptid);
         }
         $a = array();
         $datagagal = '';
         $nonik = 0;
         for ($i = 5; $i <= $data->rowcount($sheet_index = 0); $i++) {
             $nik = $data->val($i, 1);
             if ($nik != '') {
                 if (isset($array[$nik])) {
                     $userid = $nik;
                     $name = $array[$nik]['name'];
                     $group = $array[$nik]['group'];
                     $data_arr = array('userid' => $userid, 'name' => $name, 'group' => $group);
                     $tgla = '';
                     $tanggal = strtotime($blth . '-' . $data->val(3, 3));
                     for ($j = 3; $j <= $data->colcount($sheet_index = 0); $j++) {
                         $tgla .= $tanggal + ($j - 3) * 86400 . "\t";
                         $tglan = $tanggal + ($j - 3) * 86400;
                         $shift[$j] = $data->val($i, $j);
                         if ($shift[$j] != '') {
                             $savedata = array('userid' => $userid, 'rosterdate' => date('Y-m-d', $tglan), 'absence' => $shift[$j]);
                             $data_arr[$tglan] = $shift[$j];
                         } else {
                             $data_arr[$tglan] = $shift[$j];
                         }
                     }
                     $fieldarr[] = $data_arr;
                 } else {
                     $datagagal = $datagagal . $nik . ', ';
                 }
             } else {
                 $nonik++;
             }
         }
         $fp = fopen('assets/js/template/roster_' . $this->my_usession->userdata('user_id') . '.json', 'w');
         fwrite($fp, json_encode(array('data' => $fieldarr)));
         fclose($fp);
         if (strpos($datagagal, ',') !== false) {
             $datagagal = substr($datagagal, 0, -2);
         }
         $tgl = "userid\tname\t";
         $tglan = explode("\t", $tgla);
         $count = count($tglan);
         for ($i = 0; $i < $count - 1; $i++) {
             if (in_array(date('Y-m-d', $tglan[$i]), $holarray)) {
                 $tgl .= $tglan[$i] . "#\t";
             } else {
                 $tgl .= $tglan[$i] . "\t";
             }
         }
         $actionlog = array('user' => $this->my_usession->userdata('username'), 'ipadd' => $this->ipaddress->get_ip(), 'logtime' => date("Y-m-d H:i:s"), 'logdetail' => 'Import roster', 'info' => $this->lang->line('message_success'));
         $this->db->insert('actionlog', $actionlog);
         $hasil = array("responseText" => "success", "success" => true, "tglawal" => $tglan[0], "tglakhir" => $tglan[$count - 2], "datagagal" => $datagagal, "nonik" => $nonik, "field" => $tgl);
         echo json_encode($hasil);
     } else {
         $hasil = array("responseText" => $this->lang->line('message_failimport'), "success" => false);
         echo json_encode($hasil);
     }
 }
开发者ID:boombaw,项目名称:masterwoow,代码行数:87,代码来源:roster.php

示例14: die

<?php

ini_set("memory_limit", "10000M");
$conn = mysql_connect("localhost", "mahimagroup", "Mahima123") or die("Couldn't connect to server.");
$db = mysql_select_db("mahimagroup", $conn) or die("Couldn't select database.");
ini_set("display_errors", 1);
error_reporting(E_ALL);
require_once 'excel/excel_reader2.php';
$data = new Spreadsheet_Excel_Reader("itemMaster.xls");
for ($row = 2; $row <= $data->rowcount(); $row++) {
    $sql = "SELECT uom_id FROM ms_uom where name = '" . $data->value($row, 6) . "'";
    $result = mysql_query($sql) or die("Error in : " . $sql . "<br>" . mysql_errno() . " : " . mysql_error());
    if (mysql_num_rows($result) > 0) {
        $row_1 = mysql_fetch_array($result);
        $unit_id = $row_1['uom_id'];
    }
    $sql = "SELECT department_id  FROM ms_department where name = '" . $data->value($row, 2) . "'";
    $result = mysql_query($sql) or die("Error in : " . $sql . "<br>" . mysql_errno() . " : " . mysql_error());
    if (mysql_num_rows($result) > 0) {
        $row_1 = mysql_fetch_array($result);
        $department_id = $row_1['department_id'];
    }
    $sql = "SELECT machinary_id FROM ms_machinary where name = '" . $data->value($row, 3) . "'";
    $result = mysql_query($sql) or die("Error in : " . $sql . "<br>" . mysql_errno() . " : " . mysql_error());
    if (mysql_num_rows($result) > 0) {
        $row_1 = mysql_fetch_array($result);
        $machinary_id = $row_1['machinary_id'];
    }
    echo $sql_item = "insert into ms_item_master set\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tname = '" . addslashes($data->value($row, 1)) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdepartment_id = '" . $department_id . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tuom_id = '" . $unit_id . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmachinary_id = '" . $machinary_id . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdrawing_number ='" . $data->value($row, 4) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcatelog_number = '" . $data->value($row, 5) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype_of_item = '" . $data->value($row, 8) . "'";
    //$result_ins = mysql_query($sql_item) or die("Error in query:".$sql_item."<br>".mysql_error().":".mysql_errno());
}
开发者ID:shailendra999,项目名称:hr_admin,代码行数:31,代码来源:mahima_export_item.php

示例15: sql

        src="jquery-1.5.1.min.js"></script>-->
<script type="text/javascript" 
        src="../lib/js/jquery-ui/js/jquery-ui-1.8.11.custom.min.js"></script>                                  
      
</head>
<body>
    
<?php 
// menggunakan class phpExcelReader
include "../lib/excel_reader2.php";
include "../lib/koneksi.php";
include "../lib/function.php";
// membaca file excel yang diupload
$data = new Spreadsheet_Excel_Reader($_FILES['userfile']['tmp_name']);
// membaca jumlah baris dari data excel
$baris = $data->rowcount($sheet_index = 0);
// nilai awal counter untuk jumlah data yang sukses dan yang gagal diimport
$sukses = 0;
$gagal = 0;
// import data excel mulai baris ke-2 (karena baris pertama adalah nama kolom)
for ($i = 2; $i <= $baris; $i++) {
    // membaca data bcf15 (kolom ke-1)
    $bmnno = $data->val($i, 1);
    $bmntgl = $data->val($i, 2);
    $bmntglsql = sql($bmntgl);
    $tahunkep = substr($bmntglsql, 0, 4);
    $dok_asal = $data->val($i, 3);
    $nomordokasal = $data->val($i, 4);
    $tglmordokasal = $data->val($i, 5);
    $tglmordokasalsql = sql($tglmordokasal);
    $tahunmordokasalsql = substr($tglmordokasalsql, 0, 4);
开发者ID:ali-ghanas,项目名称:sitampan,代码行数:31,代码来源:uploadbmnproses.php


注:本文中的Spreadsheet_Excel_Reader::rowcount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。