I have a code that is skipping 1 line and making a header from it. How can I skip 2 lines ? (One is like it is – header , but second I want to put to the bin) Is there any parameter that control it ?
JavaScript
x
if (isset($file) && $file["tmp_name"] != "") {
$this->dat = $this->ck->getData();
$fl = fopen($file['tmp_name'], "r");
// LEAVE A HEADER
for ($colSkipIdx = 0; $colSkipIdx < $colSkipNum; $colSkipIdx++) {
$head = $csv->fgetcsv_reg($fl, 2048, ","); // 1 LINE THROW AWAY
mb_language("Polish");
mb_convert_variables(MAIN_CHARSET, "SJIS-win", $head);
}
Advertisement
Answer
You can always use
JavaScript
if ($colSkipIdx == 1) {/*your code*/}
which should be your second line
And if you want to skip it or do something else with all following lines then you can do
JavaScript
if ($colSkipIdx > 1) {/*your code*/}