Share via


SQLSRV Driver API Reference (Microsoft Drivers for PHP for SQL Server)

The API name for the SQLSRV driver in the Microsoft Drivers for PHP for SQL Server is sqlsrv. All sqlsrv functions begin with sqlsrv_ and are followed by a verb or a noun. Those followed by a verb perform some action and those followed by a noun return some form of metadata.

In This Section

The SQLSRV driver contains the following functions:

Function

Description

sqlsrv_begin_transaction

Begins a transaction.

sqlsrv_cancel

Cancels a statement; discards any pending results for the statement.

sqlsrv_client_info

Provides information about the client.

sqlsrv_close

Closes a connection. Frees all resources associated with the connection.

sqlsrv_commit

Commits a transaction.

sqlsrv_configure

Changes error handling and logging configurations.

sqlsrv_connect

Creates and opens a connection.

sqlsrv_errors

Returns error and/or warning information about the last operation.

sqlsrv_execute

Executes a prepared statement.

sqlsrv_fetch

Makes the next row of data available for reading.

sqlsrv_fetch_array

Retrieves the next row of data as a numerically indexed array, an associative array, or both.

sqlsrv_fetch_object

Retrieves the next row of data as an object.

sqlsrv_field_metadata

Returns field metadata.

sqlsrv_free_stmt

Closes a statement. Frees all resources associated with the statement.

sqlsrv_get_config

Returns the value of the specified configuration setting.

sqlsrv_get_field

Retrieves a field in the current row by index. The PHP return type can be specified.

sqlsrv_has_rows

Detects if a result set has one or more rows.

sqlsrv_next_result

Makes the next result available for processing.

sqlsrv_num_rows

Reports the number of rows in a result set.

sqlsrv_num_fields

Retrieves the number of fields in an active result set.

sqlsrv_prepare

Prepares a Transact-SQL query without executing it. Implicitly binds parameters.

sqlsrv_query

Prepares and executes a Transact-SQL query.

sqlsrv_rollback

Rolls back a transaction.

sqlsrv_rows_affected

Returns the number of modified rows.

sqlsrv_send_stream_data

Sends up to eight kilobytes (8 KB) of data to the server with each call to the function.

sqlsrv_server_info

Provides information about the server.

Reference

PHP Manual

See Also

Concepts

Constants (Microsoft Drivers for PHP for SQL Server)

Other Resources

Introducing the Microsoft Drivers for PHP for SQL Server

Programming Guide

Getting Started