Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to print table from php file to TCPDF in following scenario?
    text
    copied!<p>I have a php file(add_member.php). I'm creating a dynamic table by executing SQL query. The code of this file is as follows:</p> <pre><code>$sql = SELECT * FROM member_details WHERE lname='ABC'; $n = new data(); $res = $n -&gt; querySend($sql); ?&gt; &lt;table border="1" cellpadding="3" cellspacing="1"&gt; &lt;tr&gt; &lt;td align="center"&gt;&lt;/td&gt; &lt;td align="center"&gt;First Name&lt;/td&gt; &lt;td align="center"&gt;Last Name&lt;/td&gt; &lt;td align="center"&gt;Caste&lt;/td&gt; &lt;td align="center"&gt;Residence address&lt;/td&gt; &lt;td align="center"&gt;Education&lt;/td&gt; &lt;/tr&gt; &lt;?php $i=1; while($row = mysql_fetch_array($res)) { $member_no = $row['member_no']; $total_member = "SELECT COUNT(*) AS total_member FROM family_member_details WHERE member_no =" .$member_no; $total_res = $n -&gt; querySend($total_member); $row_total = mysql_fetch_array($total_res); ?&gt; &lt;tr&gt; &lt;td align="center" rowspan="&lt;?php echo $row_total['total_member']+1;?&gt;"&gt;&lt;?php echo $i;?&gt;&lt;/td&gt; &lt;td align="center"&gt;&lt;?php echo $row['fname'];?&gt;&lt;/td&gt; &lt;td align="center"&gt;&lt;?php echo $row['lname'];?&gt;&lt;/td&gt; &lt;td align="center"&gt;&lt;?php echo $row['caste'];?&gt;&lt;/td&gt; &lt;td align="center"&gt;&lt;?php echo $row['residence_addr'];?&gt;&lt;/td&gt; &lt;td align="center"&gt;&lt;?php echo $row['education'];?&gt;&lt;/td&gt; &lt;/tr&gt; &lt;?php $family_sql = "SELECT * from family_member_details WHERE member_no = $member_no"; $family_res = $n -&gt; querySend($family_sql); while($row1 = mysql_fetch_array($family_res)) { ?&gt; &lt;tr&gt; &lt;td align="center"&gt;&lt;?php echo $row1['name']?&gt;&lt;/td&gt; &lt;td align="center"&gt;&lt;?php echo $row1['name']?&gt;&lt;/td&gt; &lt;td align="center"&gt;&lt;?php echo $row1['name']?&gt;&lt;/td&gt; &lt;td align="center"&gt;&lt;?php echo $row1['name']?&gt;&lt;/td&gt; &lt;td align="center"&gt;&lt;?php echo $row1['name']?&gt;&lt;/td&gt; &lt;/tr&gt; &lt;?php } $i++; } ?&gt; &lt;/table&gt; </code></pre> <p>Now upon clicking on a button I want to create the same table into PDF file. For this purpose I decided to use TCPDF library. But for it I've to provide the HTML content to TCPDF file. Now my issue is how should I get the HTML of a dynamically generated table from PHP file and write this content to the text file? Can anyone please help me in this regard? Any help would be highly appreciated. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload