sql - PHPEXCEL : php excel only show 1 letter -


please me on phpexcel. shows 1 letter. php code:

$sql_question   =   "select * tna_question title_id = '$tid' order section_id";  $result_question    =   mysql_query($sql_question, $db);  $category   =   array();  while ($row = mysql_fetch_assoc($result_question)) {     $arr1   =   $row['question'];     $arr    =   array_push($category ,$arr1);     $category_count++; }  $arr3[]     =   $category; 

the result sql query array:

array ( [0] => gfhgfh [1] => gfhfg [2] => fggfdg [3] => fds [4] => asd [5] => fghgfh [6] => policy wordings / coverage [7] => risk assessment / survey & underwriting [8] => policy wordings / coverage [9] => risk assessment / survey & underwriting )  

when use line:

$objphpexcel->setactivesheetindex()->fromarray($category, null, 'c7'); 

it gives me first letter each row

enter image description here

but if make one:

$objphpexcel->setactivesheetindex()->fromarray($arr3, null, 'c7'); 

it'll give data in 1 row. enter image description here

but output want this:

enter image description here

you can use below code desired result :

foreach($arr3 $k => $v){      $objphpexcel->getactivesheet()->setcellvaluebycolumnandrow($col, $k, $v);  } 

note : changing column value make go left , right only. in case want shift entire thing down replace $k $k+$val $val number of rows want shift down.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -