Welcome Guest, Not a member yet? Register   Sign In
basic question table class
#1

[eluser]bill19[/eluser]
Hello all,

I am trying to print out the output of the table class in a view, but I'm getting the following:

Quote:Severity: Notice

Message: Undefined variable: output

Here's my controller code:

Code:
$sql="Select * from data where id=$var1";
            echo $sql;
            $data=R::getall($sql);
            $output= $this->table->generate($data);
            
            echo $output; // this works correctly
            

            $this->load->view('table_widget',array($output));
//

Here's my view code:

Code:
<?php
            
echo $output;

?>


I can print out correct output in controller but not view.can anyone give me some pointers.

Thank you,

Bill





#2

[eluser]Aken[/eluser]
Read "Adding Dynamic Data to the View"
#3

[eluser]theprodigy[/eluser]
Code:
$this->load->view('table_widget',array($output));
This line is where your mistake is.
Try:
Code:
$this->load->view('table_widget',array('output'=>$output));
#4

[eluser]bill19[/eluser]
Thank you very much. Its working now.

Regards,

Bill




Theme © iAndrew 2016 - Forum software by © MyBB