In PHP I'm using the fputcsv
function to produce a comma separated file for import in a MySQL-table (using LOAD DATA INFILE
) :
fputcsv($fcsv, array(
$id,
$name,
$optional
));
$optional
can be empty so in MySQL this should be NULL
In the MySQL documentation I read that to import a NULL
value, it should be defined as \N
in the csv-file.
But the fputcsv
function puts quotes around it, so MySQL thinks it's the string "\N"
.
Is there a solution for this, or should I forget about using fputcsv
?