Welcome Guest, Not a member yet? Register   Sign In
how to display a mysql table class in a View
#1

[eluser]Neoraj3.0[/eluser]
Hi
I read http://ellislab.com/codeigniter/user-gui...table.html for generating tables in CI.

This works well in the controller:


$this->load->library('table');

$query = $this->db->query("SELECT * FROM my_table");

echo $this->table->generate($query);



But how do you display it in the view instead? I am sort of new to CI.
#2

[eluser]Neoraj3.0[/eluser]
Ok nevermind I figured it out.

I needed to change:

echo $this->table->generate($query);

to:

$data['wer'] = $this->table->generate($query);

Then in the view add this code: <?= $wer? >






Theme © iAndrew 2016 - Forum software by © MyBB