2011-08-08 108 views
0

我工作的模塊中,我必須使從PHP頁面的PDF。我m使用tcpdf但m面臨一個問題,該文件包含一些MySQL查詢和php編碼,這是不是由pdf頁面執行。使用tcpdf創建pdf時可以執行php代碼嗎?

$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

你可以發佈一些示例代碼? – Jacob

+0

我使用1.tcpdf.php,2. example_062.php,3.調用包含php + mysql + html代碼的第三個文件。 – Pranoti

+0

@cularis先生,請幫助我。 – Pranoti

回答

0

我要去這裏走出去的肢體,並建議你運行你的查詢拳頭,然後建立你的PDF文件。如果您在構建pdf後運行查詢,那麼它當然無法訪問您的數據。如果這沒有幫助,那麼我一定不明白你在問什麼。

+0

謝謝先生...... – Pranoti

相關問題