note 111902 rejected from function.fgetcsv by aharvey
| From: | aharvey@php.net | Date: | Thu, 11 Apr 2013 00:03:49 +0000 |
| Subject: | note 111902 rejected from function.fgetcsv by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-194439@lists.php.net to get a copy of this message | ||
Note Submitter: m_roji28 at yahoo dot com
----
I have data in phpmyadmin, example:
||from||to||messages||
||john||andy||meeting now||
||dony||sherly||Place in \"Jakarta\" , Indonesia, 15412
when I export to csv via phpmyadmin version 3.5.6, I get this csv file:
"from","to","messages"
"john","andy","meeting now"
"from","to","Place in \""Jakarta\"" , Indonesia,
15412"
if I use this code
<?php
// code start
$file = fopen($path, 'r');
while (($line = fgetcsv($file)) !== FALSE) {
print_r($line);
}
fclose($file);
// code end
?>
I hope get this
//output start
Array
(
[0] => from
[1] => to
[2] => messages
)
Array
(
[0] => john
[1] => andy
[2] => meeting now
)
Array
(
[0] => dony
[1] => sherly
[2] => Place in \"Jakarta\" , Indonesia, 15412
)
//output end
but instead I get
//output start
Array
(
[0] => from
[1] => to
[2] => messages
)
Array
(
[0] => john
[1] => andy
[2] => meeting now
)
Array
(
[0] => from
[1] => to
[2] => Place in \"Jakarta\""
[3] => Indonesia
[4] => 15412"
)
//output end
anyone can help this error?