-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtctest.php
More file actions
58 lines (52 loc) · 1.47 KB
/
tctest.php
File metadata and controls
58 lines (52 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
//require_once('tcpdf/lang/eng.php')
require_once 'tcpdf/tcpdf.php';
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
$pdf->SetFont('helvetica', '', 9);
$pdf->AddPage();
error_reporting(E_ALL) ; ini_set('display_errors', '1');
$con=mysql_connect("localhost","root","");
if(!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("pbas_db");
$result = mysql_query("SELECT * from gen_info where User_Id='n'");
if (($result))
{
$html = '';
$html .= "<table width='100%'><tr>";
if (mysql_num_rows($result)>0)
{
$i = 0;
while ($i < mysql_num_fields($result))
{
$html .="<th>". mysql_field_name($result, $i) . "</th>";
$i++;
}
"</tr>";
while ($rows = mysql_fetch_array($result,MYSQL_ASSOC))
{
$html .= "<tr>";
foreach ($rows as $data)
{
$html .="<td align='center'>". $data . "</td>";
}
}
}else{
$html .="<tr><td colspan='" . ($i+1) . "'>No Results found!</td></tr>";
}
$html .="</table>";
}else{
"Error in running query :". mysql_error();
}
$pdf->writeHTML($html, true, 0);
$pdf->lastPage();
$pdf->Output('htmlout.pdf', 'I');
?>