[eluser]buckboru[/eluser]
I’m trying to populate a field on a new record with the results of a Select_max query.
I’m getting the proper result from the query, but i’m doing something dumb in my set_fields function.
Via debug i can see the result of query gets the correct value, but i’m not getting $fields[‘TAPEID’] loaded.
Probably a super simple problem, but i’m not sure how to resolve it at the moment.
Thanks.
Code:
function _set_fields(){
$fields['LABEL'] = 'TAPELABEL';
$fields['TAPEID'] = $this->Tape_model->getMaxTape();
$fields['SYSTEM'] = 'SYSTEM';
$fields['LOCATION'] = 'LOCATION';
$fields['STATUS'] = 'STATUS';
$fields['NOTES'] = 'NOTES';
Code:
function getMaxTape()
{
$this->db->select_max('TAPEID');
$query = $this->db->get('tstmis.tapeinv');
return $query->result();
}