php - phpexcel Append lines into one cell in a while loop -


i have query gives me output of 4 recordsets like:

    |1  |tree       |     |2  |apple      |     |3  |orange     |     |4  |strawberry | 

in php file these output correctly. want these 4 recordsets after export in 1 excel cell in a8, there last recordset

    |4  |strawberry | 

i don't know why doesn't works. here code:

    $mrabfrage = "select motif_regularisation                          regul_stock_devise                         regul_stock_devise.date_regularisation = '$dreg'";      $mrergebnis = mysql_query($mrabfrage) or die("query failed error: ".mysql_error());      while($rowm = mysql_fetch_array($mrergebnis))         {             $motif        =   $rowm['motif_regularisation'];              $objworksheet->setcellvalue('a8', $motif."\n");             $objworksheet->getstyle('a8')->getalignment()->setwraptext(true);             $rowm++;         } 

what resolve these problem?

thx in advance

do want this?

+--------+-----------+ |4       |tree       | |        |apple      | |        |orange     | |        |strawberry | +--------+-----------+ 

you need append value, not overwrite it, in each iteration:

$prev_value = $objworksheet->getcell('a8')->getvalue(); $objworksheet->setcellvalue('a8', $prev_value.$motif."\n"); 

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -