SQL Server - Warning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][FreeTDS][SQL Server]Invalid cursor state, SQL state 24000 in SQLExecDirect

Asked By R P on 09-Oct-14 09:20 AM
help! how could i solve this following error:
Warning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][FreeTDS][SQL Server]Invalid cursor state, SQL state 24000 in SQLExecDirect in line...

i googled it for such a long time now and resolved nothing.
i have learned that this error occurs when the odbc driver couldn't handle the query statements
but the statement in my odbc_exec() is very simple.

i also read that by enabling the mssql.so would do the trick but i couldn't install it:
Cannot find config.m4.
Make sure that you run '/usr/bin/phpize' in the top level source directory of the module

i'm not sure what it meant. typed "phpize" in the directory /usr/bin but still receiving the same error. sorry for being silly!

is there any way how to solve the "invalid cursor" error or the "cannot find config.m4" error.

odbc_free_result - Luc Bomans replied to R P on 09-Oct-14 09:21 AM

I found a solution on

http://dba.fyicenter.com/faq/sql_server_2/PHP_odbc_fetch_array_Looping_through_Returning_Rows.html

For our problem adding odbc_free_result($result); was a solution.