我正在尝试编写一个代码,我必须在其中打印数据库的内容并将其输出为 pdf 文件
但是我似乎遇到了问题
当我导出数据库中的所有内容时,我的 pdf 不显示任何内容
但如果我限制它,例如 LIMIT 5
它可以正常工作并正确打印数据
有没有办法让它打印我的数据库而不必使用限制,因为我需要将它打印在单个 pdf 文件中
//tcpdf 库的设置
    ob_start();
    session_start();
    include('connect.php');
    include('../libraries/tcpdf/tcpdf.php');
    include('../libraries/tcpdf/config/lang/eng.php');
    // create new PDF document
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    // set document information
    $pdf->SetCreator(PDF_CREATOR);
    $pdf->SetAuthor('Test');
    $pdf->SetTitle('Report');
    $pdf->SetSubject('Report');
    $pdf->SetKeywords('Test, Report, Data, Form, Results');
    // set default header data
    $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
    $pdf->setFooterData($tc=array(0,64,0), $lc=array(0,64,128));
    // 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->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 default font subsetting mode
    $pdf->setFontSubsetting(true);
    // Set font
    // dejavusans is a UTF-8 Unicode font, if you only need to
    // print standard ASCII chars, you can use core fonts like
    // helvetica or times to reduce file size.
    $pdf->SetFont('dejavusans', '', 14, '', true);
    // remove default header
    $pdf->setPrintHeader(false);
    // Add a page
    // This method has several options, check the source code documentation for more information.
    $pdf->AddPage();
//查询和打印到pdf
    //queries
    $c_name=DB::queryOneField('report_name',"SELECT * from reports r INNER JOIN report_fields rf on r.report_id=rf.report_id INNER JOIN searchcolumn s on rf.field_id=s.scol_id where r.report_id=%i",$_GET['c_id']);
    if($_GET['custom']==true)
    {
        $a=DB::query("SELECT * from reports r INNER JOIN report_fields rf on r.report_id=rf.report_id INNER JOIN searchcolumn s on rf.field_id=s.scol_id where r.report_id=%i",$_GET['c_id']);  
        $s = DB::query("SELECT * FROM alumni order by ln,batch ASC); //<-- ------------------ this is the part where it works if you add LIMIT 5 in the sql statement
        foreach($s as $m){
            foreach($a as $c){
        $line2 .=
        str_replace(",","",$c['advsearch_name']) . ": " . str_replace(",","",$m[$c['advsearch_col']]) . "<br />";
            }
        $line2 .="<br />";
        }
        $data="$line2";
    }
    // Set some content to print
    $html = <<<EOD
    <hr>
    <table>
    <tr>
        <td width="60%">REPORTS - $rp_name</td>
    </tr>
    </table>
    <br>
    $data
    EOD;
    // Print text using writeHTMLCell()
    $pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);
    ob_end_clean();
        // Close and output PDF document
        // This method has several options, check the source code documentation for more information.
        $pdf->Output('application.pdf', 'I');
我错过了什么吗?
谢谢