note 105244 added to function.fgetcsv
| From: | phpdotnet at sewerewes dot com | Date: | Thu, 04 Aug 2011 20:09:47 +0000 |
| Subject: | note 105244 added to function.fgetcsv | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182231@lists.php.net to get a copy of this message | ||
Below function - csv_file_to_mysql_table() - works great but won't work at all unless
you've got your own quote_all_array() function. Here's a quick'n'dirty one
(which covers most situations):
<?php
function quote_all_array($arr)
{
foreach ($arr as $k=>$v)
{
$returnArr[$k] = ($v) ?
'"'.str_replace('"','\"',$v).'"' :
"NULL" ;
}
return $returnArr;
}
?>
----
Server IP: 217.160.235.204
Probable Submitter: 68.41.152.212
----
Manual Page -- http://www.php.net/manual/en/function.fgetcsv.php
Edit -- https://master.php.net/note/edit/105244
Del: integrated -- https://master.php.net/note/delete/105244/integrated
Del: useless -- https://master.php.net/note/delete/105244/useless
Del: bad code -- https://master.php.net/note/delete/105244/bad+code
Del: spam -- https://master.php.net/note/delete/105244/spam
Del: non-english -- https://master.php.net/note/delete/105244/non-english
Del: in docs -- https://master.php.net/note/delete/105244/in+docs
Del: other reasons-- https://master.php.net/note/delete/105244
Reject -- https://master.php.net/note/reject/105244
Search -- https://master.php.net/manage/user-notes.php