Reputation: 5954
How do I resolve this error? I was hoping to get an associative array of the first row of the result without having to name all the columns.
PHP Warning: odbc_result(): Field index is larger than the number of fields
$sql = "sql query with 14 columns";
$result = odbc_do($link, $sql) or trigger_error("query failed ".odbc_errormsg(), E_USER_ERROR);
$details = odbc_fetch_array($result,0);
return $details;
Upvotes: 0
Views: 281
Reputation: 21
Try replacing 0 with 1
odbc_fetch_array($result,0);
with
odbc_fetch_array($result,1);
Upvotes: 1