عندي مشروع فيه طلاب كثير , ولما كنا نجرب مع عدد قليل من الطلاب كانت التقارير تظهر بدون مشاكل , وعند التطبيق العملي وزيادة عدد الطلاب بدأت المشكلة بالظهور ,
فلما نطلب تقرير بطلاب مجمع واحد يظهر التقرير , ولكن لما نطلب تقرير لطلاب جميع المجمعات يظهر الخطأ التالي :
Network Error (tcp_error)
A communication error occurred: "Operation timed out"
The Web Server may be down, too busy, or experiencing other problems preventing it from responding to requests. You may wish to try again at a later time.
For assistance, contact your network support team
والخطأ يظهر بعد 33 ثانية تقريبًا من طلب التقرير , وهذا هو الكود المسأول عن طباعة التقرير :
<?php
require_once('./tcpdf/tcpdf.php');
require_once('./DBConnect.php');
require_once('./StudentsInfo.php');
$tital ='';
if(!empty($_POST['ComplexName'])) {
$ComplexName = $_POST['ComplexName'];
$tital=$ComplexName;
if($_POST['ComplexName']=='ch'){
$ComplexName ='جميع طلاب المجمعات';
$stud = new StudentsInfo();
$upit = $stud->getA();
$tital=$ComplexName;
} else {
$upit = "SELECT * FROM students WHERE ComplexName ='$ComplexName';";
}
}
if(!empty($_POST['StNO'])) {
$StNO = $_POST['StNO'];
$upit = "SELECT * FROM students WHERE StudentNO ='$StNO';";
$tital='رقم الإثبات '.$StNO;
}
$con = new DBConnect();
$result = mysql_query($upit);
$con->close();
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
// Extend the TCPDF class to create custom Header and Footer
class MYPDF extends TCPDF {
//Page header
public function Header() {
// Logo
// $image_file = '../images/atko.gif';
// $this->Image($image_file, 15, 5, 30, '', 'gif', '', 'T', false, 300, '', false, false, 0, false, false, false);
}
// Page footer
public function Footer() {
// Position at 15 mm from bottom
$this->SetY(-15);
// Set font
$this->SetFont('dejavusans', 'I', 10);
// Page number
$this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
}
}
// create new PDF document
$pdf = new MYPDF('l', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
//$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetMargins(PDF_MARGIN_LEFT, 40, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
//$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set font
$fontname = $pdf->addTTFfont('./tcpdf/fonts/aealarabiya.php', 'TrueTypeUnicode', '', 96);
$pdf->SetFont($fontname, '', 14, '', false);
// add a page
$pdf->AddPage();
$pdf->Cell(0,5,'المملكة العربية السعودية',0,1,'R');
$pdf->Cell(0,5,'الجمعية الخيرية لتحفيظ القرآن الكريم بمنطقة الحدود الشمالية',0,1,'R');
$pdf->writeHTML('<br>', true, false, false, false, '');
$pdf->writeHTML('<hr>', true, false, false, false, '');
$pdf->Cell(0,5,$tital,0,1,'C');
$tbl_header = '<style>
table {
border-collapse: collapse;
border-spacing: 0;
margin: 0 10px;
}
tr {
padding: 3px 0;
}
th {
background-color: #CCCCCC;
border: 1px solid #F5820F;
color: #333333;
font-family: trebuchet MS;
font-size: 14px;
text-align: left;
}
td {
background-color: #EEEEEE;
border: 1px solid #F5820F;
font-size: 16px;
color: #5511FF;
}
</style>
<br><br>
<table id="gallerytab" cellpadding="5" border="0">
<tr>
<th>نهاية الحفظ</th>
<th>الفصل 3 <br>الفترة 2</th>
<th>نهاية الحفظ</th>
<th>الفصل 3 <br>الفترة 1</th>
<th>نهاية الحفظ</th>
<th>الفصل 2 <br>الفترة 2</th>
<th>نهاية الحفظ</th>
<th>الفصل 2 <br>الفترة 1</th>
<th>نهاية الحفظ</th>
<th>الفصل 1 <br>الفترة 2</th>
<th>نهاية الحفظ</th>
<th>الفصل 1 <br>الفترة 1</th>
<th>بداية الحفظ</th>
<th>اسم الحلقة</th>
<th>اسم المجمع</th>
<th>اسم الطالب</th>
<th>رقم الإثبات</th>
</tr>';
$tbl_footer = '</table>';
$tbl = '';
while ($row= mysql_fetch_assoc($result)) {
$tbl .= '
<tr>
<td>'.$row['Saving3B'].'</td>
<td>'.$row['Term3B'].'</td>
<td>'.$row['Saving3A'].'</td>
<td>'.$row['Term3A'].'</td>
<td>'.$row['Saving2B'].'</td>
<td>'.$row['Term2B'].'</td>
<td>'.$row['Saving2A'].'</td>
<td>'.$row['Term2A'].'</td>
<td>'.$row['Saving1B'].'</td>
<td>'.$row['Term1B'].'</td>
<td>'.$row['Saving1A'].'</td>
<td>'.$row['Term1A'].'</td>
<td>'.$row['SaveStart'].'</td>
<td>'.$row['RingName'].'</td>
<td>'.$row['ComplexName'].'</td>
<td>'.$row['StudentName'].'</td>
<td>'.$row['StudentNO'].'</td>
</tr>
';
}
// output the HTML content
$pdf->writeHTML($tbl_header . $tbl . $tbl_footer, true, false, false, false, '');
//$pdf->lastPage();
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('tablica_teren.pdf', 'I');
?>ولم أستطع حل المشكلة .