ini bakal sering dipakai jadi saya tulis
<?php
$testarr = array("a" => 1, "b" => 2, "c" => 3, "d" => 4);
echo "ap";
print_r($testarr);
echo "<hr>";
$testarr_keys = array_keys($testarr);
$testarr_values = array_values($testarr);
for ($i = 0; $i <count($testarr) ; $i++) {
//testarr[$testarr_keys[$i]] = $testarr_values[$i] * 2;
// echo "testarr_keys $testarr_keys[$i]<br>";
echo "testarr_values $testarr_values[$i]<br>";
}
?>
Minggu, 14 Juli 2013
Rabu, 27 Februari 2013
code php get array from excel file xlsx
<table border=1>
<?php
//<pre>
//error_reporting(E_ALL);
set_time_limit(0);
ini_set("memory_limit","256M");
include 'rand.php';
include 'PHPExcel.inc.php';
include "db.php";
mysql_connect($site["dbhost"], $site["dblogin"], $site["dbpass"]);
mysql_select_db($site["dbname"]);
date_default_timezone_set('Asia/Jakarta');
$inputFileName = $_GET[inputFileName];
$mulai = $_GET[mulai];
echo "inputFileName $inputFileName <br>";
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . 'include_lib/Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
$csheet = $objPHPExcel->getSheetCount();
$loadedSheetNames = $objPHPExcel->getSheetNames();
foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
$hal++;
$ahal[] = $hal;
if($hal==1){
}
// echo "hal $hal <br>";
$objPHPExcel->setActiveSheetIndexByName($loadedSheetName);
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
$cbaris = count($sheetData);
$cbaris1 = $cbaris+1;
for($baris=1;$baris<$cbaris1;$baris++){
$koloma= $sheetData[$baris][A];
$kolomb= $sheetData[$baris][B];
$kolomc= $sheetData[$baris][C];
$kolomd= $sheetData[$baris][D];
$kolome= $sheetData[$baris][E];
$kolomf= $sheetData[$baris][F];
$kolomg= $sheetData[$baris][G];
$kolomh= $sheetData[$baris][H];
$kolomk= $sheetData[$baris][K];
$koloml= $sheetData[$baris][L];
$kolomj= $sheetData[$baris][J];
echo "$koloma - $kolomb - $kolomc - $kolomd - $kolome - $kolomf - $kolomg - $kolomh - $kolomi - $kolomj <br>";
}
}
echo "OK";
?>
Jumat, 07 September 2012
Kode XML utk membuat multi line grafik
<?php
include 'config.inc.php';
//We've included ../Includes/FusionCharts.php, which contains functions
//to help us easily embed the charts.
include("Includes/FusionCharts.php");
Senin, 27 Agustus 2012
Kode PHP Convert EXCEL 2007 to mySQL
kode ini powerfull
bisa multi sheet
<table border=1>
<?php
//<pre>
//error_reporting(E_ALL);
set_time_limit(0);
ini_set("memory_limit","256M");
include 'rand.php';
include 'PHPExcel.inc.php';
bisa multi sheet
<table border=1>
<?php
//<pre>
//error_reporting(E_ALL);
set_time_limit(0);
ini_set("memory_limit","256M");
include 'rand.php';
include 'PHPExcel.inc.php';
Sabtu, 25 Agustus 2012
code scan and list directories
ini kode php utk scan semua folder dan direktori dan menampilkan kedalam table.
pada kode yg di non aktifkan (di tanda /* dan */ ) itu adalah kode utk insert data ke mySQL
pada kode yg di non aktifkan (di tanda /* dan */ ) itu adalah kode utk insert data ke mySQL
Konversi data dari MS EXCEL 2007 ke Array
dalam excel ada banyak sheet, dan nantinya semua data akan di masukkan ke database mySQL.
pertama saya tampilkan array dengan print_r
hasilnya seperti dibawah
pertama saya tampilkan array dengan print_r
hasilnya seperti dibawah
Selasa, 14 Agustus 2012
Langganan:
Postingan (Atom)