Pages
Labels
- Bisnis (1)
- CIT Scripts - Financore (5)
- Cokelat (3)
- MySQL (2)
- PHP (23)
- PT Comment Indonesia (10)
- SQL Query (2)
- SQL Server 2000 (4)
- SQL Server 2005 (4)
- Tips - Tricks Cokelat (2)
Archives
Link List
- Code Igniter Indonesia
- MySQL Reference Manuals
- MySQL Tutorial
- SQL Developer
- 9 Useful jQuery Calendar and Date Picker Plugins For Web Designers
- 10 Powerful AJAZ jQuery File Uploaders
- 35 Useful jQuery Plugins for Slideshows, Graphs and Text Effects
- 30 jQuery Calendar Date Picker Plugins
- jQuery
- Web Developers Notes
- SQL Copy MySQL Table
- Natural Cooking Club Indonesia
- Aneka Resep Praline - Sedap Sekejap
- Resep Cokelat
- Pastry and Bakery
- Peluang Bisnis Hotspot
- Billing Hospot
- JpGraph
- Zend Developer Zone
- MySQL Tutorials and Others
- W3 School
- Open Source Projects
Untuk upload text file ke database (SQL Server atau MySQL) dengan delimiter titik koma (;), script php nya adalah sebagai berikut :
"
$filenm = fopen("U-THCQ-DataItemH1-1209281400.mm", "r");
// Read line by line until end of file
while(!feof($filenm)) {
$filename = fgets($filenm);
$pisah = explode(";", $filename);
$no_sj = $pisah[0];
$tgl_sj = $pisah[1];
$no_do = $pisah[2];
$tgl_do = $pisah[3];
//echo fgets($filenm) . "
";
echo $no_sj . " - " . $tgl_sj . " - " . $no_do . " - " . $tgl_do . "
";
}
fclose($filenm);
?>
"
Nama text file yang dibaca adalah : U-THCQ-DataItemH1-1209281400.mm.
Output yang dihasilkan sebagai berikut :
CBR150RC(IN)M/T - BK - BLACK - CBR 150R
CBR150RC(IN)M/T - OH - ORANGE HITAM - CBR 150R
CBR150RC(IN)M/T - PM - PUTIH MERAH - CBR 150R
CBR150RC(IN)M/T - RD - RED - CBR 150R
CBR150RC(IN)RM/T - OH - ORANGE HITAM - CBR 150R
Labels: PHP
0 Comments:
Subscribe to:
Post Comments (Atom)