I have a simple table like:
- id
- first_name
- last_name
- email
- phone
I'm using PHPExcel to export my data in XLS format
$rowNumber = 1;
while ($row = mysql_fetch_row($result)) {
$col = 'A';
foreach($row as $cell) {
$objPHPExcel->getActiveSheet()->setCellValue($col.$rowNumber,$cell);
$col++;
}
$rowNumber++;
}
Now I want to merge the two fields first_name
& last_name
in one Cell
I tried:
$rowNumber = 1;
while ($row = mysql_fetch_row($result)) {
$objPHPExcel->getActiveSheet()->setCellValue('A'.$rowNumber,$row['id'])
->setCellValue('B'.$rowNumber,$row['first_name'])
->setCellValue('C'.$rowNumber,$row['last_name']);
$rowNumber++;
}
But I get errors and don't works. Any help?