douyakao5308 2011-08-08 06:44
浏览 55
已采纳

使用tcpdf创建pdf时可以执行php代码吗?

I m working on module in which i have to make pdf from php page. I m Using tcpdf for that but m facing one problem that file contain some mysql queries and php coding which is not executed by pdf page.

$prn_no = $_POST['prn_no'];

$current_sem = $_POST['current_sem'];

$qr_fetch_sem_res_id = mysql_query("SELECT * FROM table1 WHERE ((prn='$prn_no') AND (semisterName='$current_sem'))")or die(mysql_error());

    $qr_fetch_sem_result_ans = mysql_fetch_array($qr_fetch_sem_res_id);

  <tr>
    <td colspan="11" align="left" valign="middle">Programme Name:&nbsp;<?php echo $qr_fetch_sem_result_ans['programme_name'];?></td>
  </tr>
  <tr>
    <td colspan="11" align="center" valign="middle"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="27%">Seat No.: <?php echo $qr_fetch_sem_result_ans['seatNo'];?></td>
        <td width="3%">&nbsp;</td>
        <td width="22%">PR No. : <?php echo $qr_fetch_sem_result_ans['prn'];?></td>
        <td width="2%">&nbsp;</td>
        <td width="17%">Semester : <?php echo $qr_fetch_sem_result_ans['semisterName'];?></td>
        <td width="1%">&nbsp;</td>
        <td width="25%">Month / Year Of Exam : <?php echo $qr_fetch_sem_result_ans['month_year_of_exam'];?> </td>
        <td width="3%">&nbsp;</td>
      </tr>
      <tr>
        <td colspan="3">Name: <?php echo $qr_fetch_sem_result_ans['student_name'];?></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td colspan="7">College / Institute: <?php echo $qr_fetch_sem_result_ans['institute_name'];?></td>
        <td>&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  • 写回答

1条回答 默认 最新

  • dtg7662 2011-08-08 07:30
    关注

    I'm going to go out on a limb here and suggest that you run your queries fist and then build your pdf file. If you run the queries after you build the pdf then of course it will not have access to your data. If that doesn't help then I must not understand what you're asking.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 关于变压器的具体案例分析
  • ¥15 生成的QRCode圖片加上下載按鈕
  • ¥15 板材切割优化算法,数学建模,python,lingo
  • ¥15 科来模拟ARP欺骗困惑求解
  • ¥100 iOS开发关于快捷指令截屏后如何将截屏(或从截屏中提取出的文本)回传给本应用并打开指定页面
  • ¥15 unity连接Sqlserver
  • ¥15 图中这种约束条件lingo该怎么表示出来
  • ¥15 VSCode里的Prettier如何实现等式赋值后的对齐效果?
  • ¥20 keepalive配置业务服务双机单活的方法。业务服务一定是要双机单活的方式
  • ¥50 关于多次提交POST数据后,无法获取到POST数据参数的问题