[eluser]Unknown[/eluser]
How would I go about doing a join with multiple tables properly? I have created a new controller extending codexController. What are the plugins used for? I have been playing with the DbDropDownExtended but am unsure how to properly do a join. When I try and get a column from one table when the main table is another that doesnt have a column by that name I get a db error. It always looks in the main table for all columns.
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
include("codexcontroller.php");
class Assets extends codexController
{
function Assets()
{
// Load the CodexController
codexController::codexController();
$vars = array(
"object" => array(
"class" => "DbDropDown",
"params" => array(
"primary_key" => 'asset_id',
"field" => "object",
"table" => "assets_relationships"
)
),
"url" => array("class" => "TextDisplay"),
"id" => array("class" => "TextDisplay")
);
$config = array(
'db_table' => 'assets', //The name of the table associated with this controller
'form_setup' => $vars, //The array that holds our elements
'controller_name' => 'Assets', //The name of the controller, so that it can be used when generating the URLs
'add_link' => '', // set this to '' to exclude the add button from the page
'display_fields'=>array('id','url')
);
$this->setConfig($config);
}
}