Answer the question
In order to leave comments, you need to log in
How does fetch_row work in CodeIgniter?
I can't this code
$query = "
SELECT autor, title
FROM dle_post
WHERE autor =''
AND UNIX_TIMESTAMP(date)>UNIX_TIMESTAMP('$from')
AND UNIX_TIMESTAMP(date)<UNIX_TIMESTAMP('$till')
";
$headings = array('Автор', 'Название', 'Размер');
if ($result = mysql_query($query) or die(mysql_error())) {
$objPHPExcel = new PHPExcel();
$objPHPExcel->getActiveSheet()->setTitle('Список загруженных файлов');
$rowNumber = 1;
$col = 'A';
foreach($headings as $heading) {
$objPHPExcel->getActiveSheet()->setCellValue($col.$rowNumber,$heading);
$col++;
}
// Loop through the result set
$rowNumber = 2;
while ($row = mysql_fetch_row($result)) {
$col = 'A';
foreach($row as $cell) {
$objPHPExcel->getActiveSheet()->setCellValue($col.$rowNumber,$cell);
$col++;
}
$rowNumber++;
}
// Freeze pane so that the heading line won't scroll
$objPHPExcel->getActiveSheet()->freezePane('A2');
// Save as an Excel BIFF (xls) file
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="userList.xls"');
header('Cache-Control: max-age=0');
$objWriter->save('php://output');
exit();
}
Answer the question
In order to leave comments, you need to log in
CodeIgniter is a legacy framework.
Judging by the documentation, it does not have a method for getting data per-line, but there is only a way to get all the lines into an array, and then loop through it. You do it too.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question