Calling odbc_fetch_array after executing a stored procedure in PHP gives error [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index

后端 未结 1 1075
一个人的身影
一个人的身影 2021-01-14 14:15

So, I\'m trying to use ODBC to execute a stored procedure in an SQL database, but it returns the error

odbc_fetch_array() [function.odbc-fetch-array]: 
    S         


        
相关标签:
1条回答
  • 2021-01-14 15:05

    I ran into this problem as well. The way I got around it was to use

    odbc_exec($connection, $sql)
    

    Instead of

    odbc_execute($connection, $sql)
    

    Per a user comment here

    Comment was:

    BTW. If anyone is banging his head about "cursor type changed" warning while using execute with ORDER BY clause, then just use exec for now (remember to addslashes for yourself).

    In PHP 5.3 a Bug #43668 will be fixed and it will allow you to change a cursor type to SQL_CUR_USE_ODBC

    Note that you could also try to select a cursor type in odbc_connect, but that didn't work for me (much more problems appeared then it solved).

    Apparently this is a bug in PHP, and will be patched per this

    So try using odbc_exec() insted of odbc_execute() if you are having this problem.

    0 讨论(0)
提交回复
热议问题