Welcome Guest, Not a member yet? Register   Sign In
A link in a generated table
#2

You will need to re-write some of this but you should get the idea.

PHP Code:
public function manage()
{
    
// Grab an array of users from the database
    
$data $this->users->users();

    
// Set headings for this table
    
$this->table->set_heading('Username''Email''Actions');

    foreach(
$data as $value => $key)
    {
        
// Build actions links
        
$actions anchor("admin/users/edit/".$key['id']."/""Edit").
            
anchor("admin/users/delete/".$key['id']."/""Delete");

        
// Add the new row to the table
        
$this->table->add_row($key['username'], $key['email'], $actions);
    }

    
// Load the view
    
$this->load->view('users/manage');


Any way that's how I do it, hope it helps you out.

You still need the table template, I place that in the constructor of a MY_Controller.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
A link in a generated table - by FARUKB13 - 11-07-2017, 01:32 AM
RE: A link in a generated table - by InsiteFX - 11-07-2017, 04:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB