In excel sheet, I cannot display all rows of table.My following code display only first row.
$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++;
}
TRY THIS,CHANGE ROW AND COL VARIABLE
$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++;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.