The issue is that the phonenumber is shown in scientific notation:
include_once 'PHPExcel.php';
$sheet = new PHPExcel();
$servername =
$username =
$password =
$dbname =
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT firstname, lastname, phonenumber FROM people where answer='true'";
$result = $conn->query($sql);
$x=0;
if ($result->num_rows > 0) {
// output data of each row
$activeSheet=$sheet->getActiveSheet();
while($row = $result->fetch_assoc()) {
$activeSheet->setCellValue('A'. $x,$row["firstname"]);
$activeSheet->setCellValue('B'. $x,$row["lastname"]);
$activeSheet->setCellValue('C'. $x,$row["phonenumber"]);
$activeSheet->setCellValue('D'. $x,"True");
$x++;
}
}
$conn->close();
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment; filename="report.xlsx"');
header('Cache-Control: max-age=0');
$objWriter=PHPExcel_IOFactory::createWriter($sheet,'Excel2007');
$objWriter->save('php://output');
exit;