Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用tcpdf创建pdf时是否可以执行php代码?_Php_Html_Mysql_Tcpdf - Fatal编程技术网

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

使用tcpdf创建pdf时是否可以执行php代码?,php,html,mysql,tcpdf,Php,Html,Mysql,Tcpdf,我正在开发一个模块,在这个模块中,我必须从php页面生成pdf。我正在使用tcpdf,但我面临一个问题,该文件包含一些mysql查询和php编码,而这些并不是由pdf页面执行的 $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 (semister

我正在开发一个模块,在这个模块中,我必须从php页面生成pdf。我正在使用tcpdf,但我面临一个问题,该文件包含一些mysql查询和php编码,而这些并不是由pdf页面执行的

$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);


节目名称:
座位号:
请购单编号:
学期:
考试月份/年份:
姓名:
学院/学院:

我要冒险一试,建议您先运行查询,然后构建pdf文件。如果在生成pdf后运行查询,那么它当然无法访问您的数据。如果这没有帮助,那么我一定不明白你在问什么。

你能发布一些示例代码吗?我使用的是1.tcpdf.php,2。例如_062.php,3。正在调用包含php+mysql+html代码的第三个文件。@cularis先生,请帮助我。请看这个:
  <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>