Re: csv problem.. read csv from var

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

 



----- Original Message -----
From: "Niel Archer" <niel@xxxxxxxxxxxxx>
To: <php-db@xxxxxxxxxxxxx>
Sent: Friday, February 16, 2007 1:59 PM
Subject: Re:  csv problem.. read csv from var


> hi
>
> > 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.
>
> Use
>
>   $arry = explode(',', $csv);
>
=============================CODE====================
<?
$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\"";

$arry = explode(',', $csv);

foreach($arry as $val){
 $txt.= "=".$val . "<br />\n";
}

print $txt;

?>

=============================OUTPUT===================
= 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"

> to separate the variable into an array, then process it using foreach as
> before

i'll already try that! fail.. it has tobe return 3 not ..10
thx for the reply

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

-- 
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