note 105244 deleted from function.fgetcsv by danbrown
| From: | danbrown@php.net | Date: | Thu, 04 Aug 2011 20:12:02 +0000 |
| Subject: | note 105244 deleted from function.fgetcsv by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-182232@lists.php.net to get a copy of this message | ||
Note Submitter: phpdotnet at sewerewes dot com
----
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;
}
?>