when you do the scaffolding for your database, you need to create a class to handle each table.
this can get annoying, long story short. I added session data that updates to whichever table you want to view.
class Admin extends Controller {
function __construct()
{
parent::Controller();
$this->load->helper(array('url'));
$this->is_logged_in();
if ($this->uri->segment(2) == 'scaffolding' && $this->uri->segment(3) != '' && ($this->uri->segment(4) == null))
{
$tables = $this->db->list_tables();
foreach ($tables as $table)
{
if ($this->uri->segment(3) == $table)
{
$sdata = array(
'table' => $this->uri->segment(3)
);
$this->session->set_userdata($sdata);
}
}
}
if ($this->uri->segment(2) == 'scaffolding')
{
$this->load->scaffolding($this->session->userdata('table'));
}
}
function index()
{
echo "Logged in as ". $this->session->userdata('username')."
n";
$tables = $this->db->list_tables();
foreach ($tables as $table)
{
echo "'.$table.'
';
}
}
function is_logged_in()
{
$is_logged_in = $this->session->userdata('is_logged_in');
if (!isset($is_logged_in) || $is_logged_in != true)
{
redirect('login');
die();
}
}
}
?>
the code assumes that you have a way of verifying the ability to access, as need at least some security when using scaffolding. That can be hacked out easily though.