dquoj04882 2016-11-13 07:24
浏览 20

从数据库中按名称保存PDF

I am saving my records as PDF but I want them saved by using name_empnumber like abc_123

I am using the code below and library TCFPDF

if (isset($_POST['submit'])){
    require_once 'includes/practice.php';
//practice.php is using library tcfpdf

$pdf->SetFont('times', '', 15);

$tb1 = '</br></br>  

                            <b>2-  Printer:</b><br /><br />
                            <table cellspacing="0" cellpadding="0" border="1"> 

                                <tr style="background-color:#f7f7f7;color:#333; ">


                                    <td width="300">SN</td>
                                    <td width="300">TYPE</td>

                                </tr>

                            </table>';

$result= mysql_query("SELECT * FROM accessories where emp_number='".$emp_number."' && is_accessory='Printer'");

 while($row = mysql_fetch_assoc($result)){
$tb2 = '<table cellspacing="0" cellpadding="2" border="1"> 
                <tr> 

                                <td width="300">'.$row['serial'].'</td>
                                <td width="300">'.$row['model'].'</td>        
                </tr>
            </table>';

            $tb1 = $tb1.$tb2;
        }


 $pdf->writeHTML($tb1, true, false, false, false, '');

      ob_end_clean();
      $pdf->Output('Report.pdf', 'D');
}

See this is saving as Report.PDF.

I want to save as name_empnumber.pdf like abc-123.pdf

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度