[eluser]Unknown[/eluser]
Hello All,
I am using TCPDF library to generate PDF. I have successfully used TCPDF using procedural PHP. However, I was developing same application using CI and TCPDF.
Here is Controller
Code:
function index()
{
$this->load->library('pdf');
$this->pdf->AddPage();
$this->load->model('create_pdf_model');
$pdf_data = $this->create_pdf_model->get_details();
$tbl = <<<EOD
<table cellspacing="0" cellpadding="1" border="1">
<tr>
<td rowspan="3">$pdf_data</td>
<td>Test</td>
</tr>
</table>
EOD;
$this->pdf->writeHTML($tbl, true, false, false, false);
$y = $this->pdf->Output('test', 'I');
$this->pdf->header("Content-type:application/pdf");
echo $y;
============== Model ============
Code:
$this->db->select('table');
$this->db->from('employee');
$this->db->where('emp_id', $this->uri->segment(3));
$query = $this->db->get();
$result = $query->result_array();
return $result;
==========
I am not sure what going wrong. When I load the page it shows me PDF with value as "Array" in table not employee id.
I am trying to achieve is to get few values from table in DB and send it PDF (Id, Name, Address).
It would be great if any one can please guide me through this problem.
Thanks