I am having issue in exporting data in CSV file. When i pass "Static data" then it exported. But I want "Dynamically" i.e. user_name or user_lastname store my data. So, anyone can help me to get out from this.
My Dynamic array is showing in this format inside while loop:
print_r($arr);
Array
(
[0] => Meck
)
Array
(
[0] => Bisk
)
...
while ( $query->have_posts() ) : $query->the_post();
$user_name = get_post_meta( get_the_ID(), 'glow_user_fname', true );
$first = $array = explode(' ', $user_name);
$user_lastname = get_post_meta( get_the_ID(), 'glow_user_lname', true );
$arr = $array = explode(' ', $user_lastname);
// static array which is working
//$arr = array("Welcome","to", "GeeksforGeeks", "A", "Computer","Science","Portal");
$i=2;
foreach($arr as $s){
$i++;
$sheet->setCellValue('A'.$i, $s);
}
endwhile;