csv problem.. read csv from var

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



i have problem with reading csv.. for i know the example script i get was
========================BASIC SCRIPT=================
$handle = fopen("hasillab.csv", "r");
$data2=$handle;
while($data = fgetcsv($handle, 1000, ",")){
 foreach($data as $str)
  $data2.="<br>=  ".$str;

}

the result was:
==========================OUTPUT==========================
= A507257
= 3/2/2007
= Hematologi Lengkap,Cholesterol Total,LDL Cholesterol,Trigliserida,HDL
Cholesterol

hasillab.csv contain
A507257,3/2/2007,"Hematologi Lengkap,Cholesterol Total,LDL
Cholesterol,Trigliserida,HDL Cholesterol,Asam Urat,Gula Darah Puasa,Gula
Darah 2 Jam PP,Kreatinin,Ureum,Bilirubin Total,Alkali
Fosfatase,SGOT,SGPT,Urine Lengkap,Feses Rutin,Darah Samar Faeces,VDRL,Anti -
HBs,Total PSA,HBsAg,Anti - HCV Total"

the problem i have is.. how about the csv is a var
========================DATA===============
$csv="
A507257,3/2/2007,\"Hematologi Lengkap,Cholesterol Total,LDL
Cholesterol,Trigliserida,HDL Cholesterol,Asam Urat,Gula Darah Puasa,Gula
Darah 2 Jam PP,Kreatinin,Ureum,Bilirubin Total,Alkali
Fosfatase,SGOT,SGPT,Urine Lengkap,Feses Rutin,Darah Samar Faeces,VDRL,Anti -
HBs,Total PSA,HBsAg,Anti - HCV Total\"";

what should i do to make the ouput like above.

until now.. i try save the var into files then i use basic script to load it

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux