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.

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

报告相同问题?

悬赏问题

  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 组策略中的计算机配置策略无法下发
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
  • ¥50 mac mini外接显示器 画质字体模糊