Do one, and only one, fgetcsv() before you entere the loop?
Or, if only SOME people add the header lines to their CSV file, check
if one of the numeric fields is actually numeric, and skip any "bad"
lines.
You could even keep a counter going of which line you are on, and give
an error message if
Richard Kurth wrote:
The below script will parse a csv file to a database I need to remove
the first line because it is the header files and I don't need them. How can
I test for that and remove them.
$file = fopen($_POST['copy'], 'r') or $message .= "Could not open" .
$_POST[copy] . "fo
The below script will parse a csv file to a database I need to remove
the first line because it is the header files and I don't need them. How can
I test for that and remove them.
$file = fopen($_POST['copy'], 'r') or $message .= "Could not open" .
$_POST[copy] . "for reading.\n";
3 matches
Mail list logo