Как выбрать первые 20 строк
#39784520
Ссылка:
Ссылка на сообщение:
Ссылка с названием темы:
|
|
|
Добрый день !
Как получить первые 20 строк, далее с 21-40 и т.д
помогите пжл
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71.
<?php
$xml_data_begin='<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Author>Nurzhaubay A.N.</Author>
<LastAuthor>Radmin</LastAuthor>
<Created>1980-02-15T00:00:01Z</Created>
<Version>12.00</Version>
</DocumentProperties>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Worksheet ss:Name="Result">';
$xml_data_end='<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
</Workbook>';
if (ob_get_level()) {ob_end_clean();}
// header('Content-Description: File Transfer');
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=employee.xml");
echo $xml_data_begin;
//Наименование столбца(Колонка-РЕГИОН)
echo '<Table x:FullColumns="1" x:FullRows="1" ss:DefaultRowHeight="15">
<Row ss:AutoFitHeight="0">';
echo '<Cell><Data ss:Type="String">'.mb_convert_encoding("Регион", "utf-8","windows-1251").'</Data></Cell>';
echo '<Cell><Data ss:Type="String">'.mb_convert_encoding("Область", "utf-8","windows-1251").'</Data></Cell>';
echo '<Cell><Data ss:Type="String">'.mb_convert_encoding("Город/Село", "utf-8","windows-1251").'</Data></Cell>';
echo '<Cell><Data ss:Type="String">'.mb_convert_encoding("РПУТ", "utf-8","windows-1251").'</Data></Cell>';
echo '<Cell><Data ss:Type="String">'.mb_convert_encoding("ГТС/СТС", "utf-8","windows-1251").'</Data></Cell>';
echo '<Cell><Data ss:Type="String">'.mb_convert_encoding("Лицевой счет", "utf-8","windows-1251").'</Data></Cell>';
echo '<Cell><Data ss:Type="String">'.mb_convert_encoding("ИИН", "utf-8","windows-1251").'</Data></Cell>';
echo '</Row>';
$query="select f.* from zrdt.filial f order by id";
$database->setQuery( $query );
$filials = $database->loadObjectList();
foreach ($filials as $filial) {
$query="select f.full_name f_name,d.*
from zrdt.report_detail d,zrdt.filial f where f.id=".$filial->ID." and f.id=d.filial_id
and report_id=".$report_id."
and report_result_id=".$report_result_id."
order by filial_id"
;
//echo $query;exit;
$database->setQuery( $query );
// $rows = $database->loadObjectList();
$rows = $database->loadRowList();
$i=0;
//$cnt=count($rows);
foreach($rows as $row_number){
$i++;
if($i>20)break;
}
echo $row[$i];
echo '</Table>';
echo $xml_data_end;
exit();
?>
|
|