Welcome Guest, Not a member yet? Register   Sign In
Insert Values from DB into PDF form using TCPDF
#1

[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


Messages In This Thread
Insert Values from DB into PDF form using TCPDF - by El Forum - 05-09-2011, 12:38 AM
Insert Values from DB into PDF form using TCPDF - by El Forum - 05-09-2011, 12:58 AM
Insert Values from DB into PDF form using TCPDF - by El Forum - 05-09-2011, 01:04 AM
Insert Values from DB into PDF form using TCPDF - by El Forum - 02-07-2012, 05:36 AM
Insert Values from DB into PDF form using TCPDF - by El Forum - 02-07-2012, 09:01 AM
Insert Values from DB into PDF form using TCPDF - by El Forum - 02-07-2012, 03:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB