public function table($table = UNDEFINED, $alias = UNDEFINED)
    {
        if ($table === UNDEFINED) {
            return $this->main_table;
        }

        if (is_array($table)) {
            foreach ($table as $alias => $t) {
                if (is_numeric($alias)) {
                    $alias = UNDEFINED;
                }
                $this->table($t, $alias);
            }

            return $this;
        }

        // main_table tracking allows us to
        if ($this->main_table === null) {
            $this->main_table = $alias === UNDEFINED || !$alias ? $table : $alias;
        } elseif ($this->main_table) {
            $this->main_table = false;   // query from multiple tables
        }

        // if $table is DSQL, then alias is mandatory
        if ($table instanceof DB_dsql && ($alias === UNDEFINED || !$alias)) {
            throw $this->exception('If table is passed as DSQL, then table alias is mandatory!');
        }
        
        $this->args['table'][] = array($table, $alias);

        return $this;
    }
public function table($table = UNDEFINED, $alias = UNDEFINED)
    {
        if ($table === UNDEFINED) {
            return $this->main_table;
        }

        if (is_array($table)) {
            foreach ($table as $alias => $t) {
                if (is_numeric($alias)) {
                    $alias = UNDEFINED;
                }
                $this->table($t, $alias);
            }

            return $this;
        }

        // main_table tracking allows us to
        if ($this->main_table === null) {
            $this->main_table = $alias === UNDEFINED || !$alias ? $table : $alias;
        } elseif ($this->main_table) {
            $this->main_table = false;   // query from multiple tables
        }

        // if $table is DSQL, then alias is mandatory
        if ($table instanceof DB_dsql && ($alias === UNDEFINED || !$alias)) {
            throw $this->exception('If table is passed as DSQL, then table alias is mandatory!');
        }
        
        $this->args['table'][] = array($table, $alias);

        return $this;
    }
public function table ( $ table = UNDEFINED , $ alias = UNDEFINED ) { if ( $ table === UNDEFINED ) { return $ this -> main_table ; } if ( is_array ( $ table ) ) { foreach ( $ table as $ alias => $ t ) { if ( is_numeric ( $ alias ) ) { $ alias = UNDEFINED ; } $ this -> table ( $ t , $ alias ) ; } return $ this ; } // main_table tracking allows us to if ( $ this -> main_table === null ) { $ this -> main_table = $ alias === UNDEFINED || ! $ alias ? $ table : $ alias ; } elseif ( $ this -> main_table ) { $ this -> main_table = false ; // query from multiple tables } // if $table is DSQL, then alias is mandatory if ( $ table instanceof DB_dsql && ( $ alias === UNDEFINED || ! $ alias ) ) { throw $ this -> exception ( 'If table is passed as DSQL, then table alias is mandatory!' ) ; } $ this -> args [ 'table' ] [ ] = array ( $ table , $ alias ) ; return $ this ; }
Specifies which table to use in this dynamic query. You may specify
array to perform operation on multiple tables.

Examples:
$q->table('user');
$q->table('user','u');
$q->table('user')->table('salary')
$q->table(array('user','salary'));
$q->table(array('user','salary'),'user');
$q->table(array('u'=>'user','s'=>'salary'));
$q->table($q2->table('user')->where('active',1), 'active_users');

If you specify multiple tables, you still need to make sure to add
proper "where" conditions. All the above examples return $q (for chaining)

You can also call table without arguments, which will return current table:

echo $q->table();

If multiple tables are used, "false" is returned. Return is not quoted.
Please avoid using table() without arguments as more tables may be
dynamically added later.

@param string|DB_dsql $table Specify table to use or DSQL to use as derived table
@param string $alias Specify alias for the table, if $table is DSQL, then alias is mandatory

@return $this|string
Specifies which table to use in this dynamic query . You may specify array to perform operation on multiple tables .