CodeIgniter Forums
solved: why an 'Undefined index:' ? - 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: solved: why an 'Undefined index:' ? (/showthread.php?tid=27575)



solved: why an 'Undefined index:' ? - El Forum - 02-15-2010

[eluser]Jan_1[/eluser]
Seems that I won't learn some things...
What do I have to change? I'm getting an error 'undefined index'.
Could somebody tell me why? That would be great. Thank you!!!

Code:
function get_kassenmonate($wg)
{
$list = array(
'name' => 'jan', 'where' => array('ks_datum >=' => '2010-01-01', 'ks_datum =<' => '2010-01-31'),
'name' => 'feb', 'where' => array('ks_datum >=' => '2010-02-01', 'ks_datum =<' => '2010-02-28'),
'name' => 'mrz', 'where' => array('ks_datum >=' => '2010-03-01', 'ks_datum =<' => '2010-03-31'),
'name' => 'apr', 'where' => array('ks_datum >=' => '2010-04-01', 'ks_datum =<' => '2010-04-30')
              );

foreach ($list as $step)
        {
        $this->db->select('SUM(ks_betrag) as betrag',FALSE);
        $sql = $this->db->get('ks_buchung', $step['where'], FALSE);  //<-- Undefined index: where

        if ($sql->num_rows() > 0) { $row        = $sql->row();
                                    $step['name'] = $row->betrag;}
        else                      { $step['name'] = 0; };

        echo $step['name']."<br>";
        }

also if $sql-string is without 'FALSE'

Or how could I find out?


solved: why an 'Undefined index:' ? - El Forum - 02-15-2010

[eluser]danmontgomery[/eluser]
Code:
$list = array(
array('name' => 'jan', 'where' => array('ks_datum >=' => '2010-01-01', 'ks_datum =<' => '2010-01-31')),
array('name' => 'feb', 'where' => array('ks_datum >=' => '2010-02-01', 'ks_datum =<' => '2010-02-28')),
array('name' => 'mrz', 'where' => array('ks_datum >=' => '2010-03-01', 'ks_datum =<' => '2010-03-31')),
array('name' => 'apr', 'where' => array('ks_datum >=' => '2010-04-01', 'ks_datum =<' => '2010-04-30'))
);



solved: why an 'Undefined index:' ? - El Forum - 02-15-2010

[eluser]Jan_1[/eluser]
THANK YOU, noctrum!!!