Welcome Guest, Not a member yet? Register   Sign In
CodeExtinguisher's Website Code
#23

[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);
    }
}


Messages In This Thread
CodeExtinguisher's Website Code - by El Forum - 12-15-2007, 01:18 PM
CodeExtinguisher's Website Code - by El Forum - 12-15-2007, 02:45 PM
CodeExtinguisher's Website Code - by El Forum - 12-16-2007, 01:44 AM
CodeExtinguisher's Website Code - by El Forum - 12-16-2007, 02:04 AM
CodeExtinguisher's Website Code - by El Forum - 12-16-2007, 02:20 AM
CodeExtinguisher's Website Code - by El Forum - 12-16-2007, 02:26 AM
CodeExtinguisher's Website Code - by El Forum - 12-16-2007, 02:34 AM
CodeExtinguisher's Website Code - by El Forum - 12-16-2007, 12:28 PM
CodeExtinguisher's Website Code - by El Forum - 12-16-2007, 10:07 PM
CodeExtinguisher's Website Code - by El Forum - 12-17-2007, 02:41 AM
CodeExtinguisher's Website Code - by El Forum - 12-22-2007, 03:31 PM
CodeExtinguisher's Website Code - by El Forum - 12-22-2007, 03:54 PM
CodeExtinguisher's Website Code - by El Forum - 12-23-2007, 05:23 AM
CodeExtinguisher's Website Code - by El Forum - 12-23-2007, 05:29 AM
CodeExtinguisher's Website Code - by El Forum - 12-23-2007, 10:18 AM
CodeExtinguisher's Website Code - by El Forum - 12-28-2007, 11:13 AM
CodeExtinguisher's Website Code - by El Forum - 01-28-2008, 05:20 AM
CodeExtinguisher's Website Code - by El Forum - 01-28-2008, 08:03 AM
CodeExtinguisher's Website Code - by El Forum - 02-07-2008, 09:17 AM
CodeExtinguisher's Website Code - by El Forum - 06-30-2009, 12:59 PM
CodeExtinguisher's Website Code - by El Forum - 06-30-2009, 01:16 PM
CodeExtinguisher's Website Code - by El Forum - 06-30-2009, 04:35 PM
CodeExtinguisher's Website Code - by El Forum - 11-30-2009, 08:13 PM



Theme © iAndrew 2016 - Forum software by © MyBB