CodeIgniter Forums
odbc_field_name() [function.odbc-field-name]: Field numbering starts at 1 - 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: odbc_field_name() [function.odbc-field-name]: Field numbering starts at 1 (/showthread.php?tid=48224)



odbc_field_name() [function.odbc-field-name]: Field numbering starts at 1 - El Forum - 01-09-2012

[eluser]umefarooq[/eluser]
hi, i was generating csv file from MS sql server with odbc and getting this warning

Code:
A PHP Error was encountered

Severity: Warning

Message: odbc_field_name() [function.odbc-field-name]: Field numbering starts at 1

Filename: odbc/odbc_result.php

Line Number: 68

i modified code little bit in odbc_result

Code:
function list_fields()
{
  $field_names = array();
//change from
//  for ($i = 0; $i < $this->num_fields(); $i++)
//this
                for ($i = 1; $i <= $this->num_fields(); $i++)
  {
   $field_names[] = odbc_field_name($this->result_id, $i);
  }

  return $field_names;
}

worked fine but looking for better solution or this bug need to be fixed