[eluser]someone
[/eluser]
Hello!
I'm working on some script which must use year as exposed value. This information is saved in database and I have to pull it out, but that's not the problem. I have to create list where are years exposed as main values. I was working on code, but I always get an error.
Controller:
Code:
$data['dbdata'] = $this->DBdata->serve_val('pc_year');
foreach ($data['dbdata']->result() as $data)
{
$data['sheet'] = $this->DBdata->serve_val('pc');
foreach ($data['sheet']->result() as $sht)
{
$data['vdata'][$data->idyr][$sht->idpc]['name'] = $sht->name;
$data['vdata'][$data->idyr][$sht->idpc]['properties'] = $sht->properties;
}
}
View:
Code:
foreach ($dbdata->result() as $data)
{
echo $data->year."<br>";
foreach ($sheet->result() as $sht)
{
echo $vdata[$data->idyr][$sht->idpc]['name']."<br>";
echo $vdata[$data->idyr][$sht->idpc]['properties']."<br>";
echo "<br>";
}
}
Error:
A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 1
How to do this correctly?
Thanks! :-)