CodeIgniter Forums
DB select 'feature'/'bug' - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: DB select 'feature'/'bug' (/showthread.php?tid=1974)



DB select 'feature'/'bug' - El Forum - 07-09-2007

[eluser]Unknown[/eluser]
Code:
$this->db->select(
    'this,
     that,
     -- theother,
     something
)->get('table');

reformats my select statment triming all the lines into a single line for the select part which makes '-- the other, something' commented out. I only wanted theother commented out.

offending code in system/database/DB_active_rec.php:

Code:
/**
     * Select
     *
     * Generates the SELECT portion of the query
     *
     * @access    public
     * @param    string
     * @return    object
     */
    function select($select = '*')
    {
        if (is_string($select))
        {
            $select = explode(',', $select);
        }
    
        foreach ($select as $val)
        {
            $val = trim($val);
        
            if ($val != '')
                $this->ar_select[] = $val;
        }
        return $this;
    }

what's the premise of doing it this way?

Thanks,
Jordan


DB select 'feature'/'bug' - El Forum - 07-09-2007

[eluser]champs[/eluser]
I don't think the user guide says so, but... active record supports multiple select statements.
Code:
<?php
$this->db->select('this, that');
$this->db->select('theother, something');
?>