PHPExcel does not display all rows using php

In the excel sheet, I cannot display all the rows of the table. My following code only displays the first line.

$sql="SELECT * FROM projects";
$result=mysqli_query($con,$sql);
$row = 1; 
while($row_data = $result->fetch_assoc()) {
    $col = 0;
    foreach($row_data as $key=>$value) {
        $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $value);
        $col++;
    }
    $row++;
}

      

+3


source to share


1 answer


TRY THIS, CHANGE SERIES and RING VARIABLES



$sql="SELECT * FROM projects";
$result=mysqli_query($con,$sql);
$row = 1; 
while($row_data = $result->fetch_assoc()) {
  $col = 0;
  foreach($row_data as $key=>$value) {
    $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $value);
    $row++;
  }           
}

      

0


source







All Articles