tags:

views:

853

answers:

2

I am getting the above error using PHP trying to update an MS SQL server. Any idea what may be happening here? I am using a stored procedure as the basis of the update. I can successfully execute the sproc against the SQL server away from the PHP application.

Any advice/help would be appreciated.

+3  A: 

mssql_fetch_array() should be used for SELECT commands, you won't get anything out of UPDATE, INSERT, or DELETE commands.

You can also pass a parameter to the resource by calling mssql_fetch_array($connection) assuming $connection is a valid connection to the DB.

Chris Thompson
A: 

Always test the return value of mssql_query(). If it's ===false mssql_get_last_message() can tell you why the query failed.

$query = 'SELECT x,y,z FROM [foo].[bar].[thingeling]';
$result = @mssql_query($query, $conn);
if(!$result) {
  die('MSSQL error: ' . mssql_get_last_message());
}

For debugging purposes you might want to set mssql_min_message_severity and mssql_min_error_severity to more "talkative" values.

VolkerK