A
A
Andrey Andrianov2019-05-01 07:25:05
PHP
Andrey Andrianov, 2019-05-01 07:25:05

Where does the unknown string come from?

Omniscient ALL!
I output an array to CSV in a simple way

$i=0 ;
$str = '' ;
foreach ( $newarr as $Row ) {
if (($Row[1]) && ($Row[1] != '')) {
$str .= $i .";". $Row[1] .";". $Row[2] .";". $Row[3] .";". $Row[4] .";". $Row[5] .";
" ;
++$i; 
  }
}

In the middle I get an empty entry
27;96261;340;
;;;;;;;;;
28;96356;130;
Where it comes from is not clear.
Checked for an empty value.
Even if some value - then $i would let know
Tried several times - always between 27 and 28 lines.
PS I will double-check on a larger array (5 times more)
if nothing comes out, then it means that there is a failure in line 27 due to an unclosed quote

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Arman, 2019-05-01
@Arik

I suspect one of $Row[N] just contains a set of ";" =)

S
synapse_people, 2019-05-01
@synapse_people

that's why this govnokod when there fputcsv????

T
Talyan, 2019-05-01
@flapflapjack

try trim()
if (($Row[1]) && (trim($Row[1]) != ''))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question