Microsoft SQL Server functions MS SQL Server mssql_close Close MS SQL Server connection Description int mssql_close int link_identifier Returns: true on success, false on error. Mssql_close closes the link to a MS SQL Server database that's associated with the specified link identifier. If the link identifier isn't specified, the last opened link is assumed. Note that this isn't usually necessary, as non-persistent open links are automatically closed at the end of the script's execution. Mssql_close will not close persistent links generated by mssql_pconnect. See also: mssql_connect, mssql_pconnect. mssql_connect Open MS SQL server connection Description int mssql_connect string servername string username string password Returns: A positive MS SQL link identifier on success, or false on error. Mssql_connect establishes a connection to a MS SQL server. The servername argument has to be a valid servername that is defined in the 'interfaces' file. In case a second call is made to mssql_connect with the same arguments, no new link will be established, but instead, the link identifier of the already opened link will be returned. The link to the server will be closed as soon as the execution of the script ends, unless it's closed earlier by explicitly calling mssql_close. See also mssql_pconnect, mssql_close. mssql_data_seek Move internal row pointer Description int mssql_data_seek int result_identifier int row_number Returns: true on success, false on failure. Mssql_data_seek moves the internal row pointer of the MS SQL result associated with the specified result identifier to point to the specified row number. The next call to mssql_fetch_row would return that row. See also: mssql_data_seek. mssql_fetch_array Fetch row as array Description int mssql_fetch_array int result Returns: An array that corresponds to the fetched row, or false if there are no more rows. Mssql_fetch_array is an extended version of mssql_fetch_row. In addition to storing the data in the numeric indices of the result array, it also stores the data in associative indices, using the field names as keys. An important thing to note is that using mssql_fetch_array is NOT significantly slower than using mssql_fetch_row, while it provides a significant added value. For further details, also see mssql_fetch_row. mssql_fetch_field Get field information Description object mssql_fetch_field int result int field_offset Returns an object containing field information. Mssql_fetch_field can be used in order to obtain information about fields in a certain query result. If the field offset isn't specified, the next field that wasn't yet retrieved by mssql_fetch_field is retrieved. The properties of the object are: name - column name. if the column is a result of a function, this property is set to computed#N, where #N is a serial number. column_source - the table from which the column was taken max_length - maximum length of the column numeric - 1 if the column is numeric See also mssql_field_seek. mssql_fetch_object Fetch row as object Description int mssql_fetch_object int result Returns: An object with properties that correspond to the fetched row, or false if there are no more rows. Mssql_fetch_object is similar to mssql_fetch_array, with one difference - an object is returned, instead of an array. Indirectly, that means that you can only access the data by the field names, and not by their offsets (numbers are illegal property names). Speed-wise, the function is identical to mssql_fetch_array, and almost as quick as mssql_fetch_row (the difference is insignificant). See also: mssql_fetch-array and mssql_fetch-row. mssql_fetch_row Get row as enumerated array Description array mssql_fetch_row int result Returns: An array that corresponds to the fetched row, or false if there are no more rows. Mssql_fetch_row fetches one row of data from the result associated with the specified result identifier. The row is returned as an array. Each result column is stored in an array offset, starting at offset 0. Subsequent call to mssql_fetch_rows would return the next row in the result set, or false if there are no more rows. See also: mssql_fetch_array, mssql_fetch_object, mssql_data_seek, mssql_fetch_lengths, and mssql_result. mssql_field_length Get the length of a field Description int mssql_field_length int result int offset mssql_field_name Get the name of a field Description int mssql_field_name int result int offset mssql_field_seek Set field offset Description int mssql_field_seek int result int field_offset Seeks to the specified field offset. If the next call to mssql_fetch_field won't include a field offset, this field would be returned. See also: mssql_fetch_field. mssql_field_type Get the type of a field Description string mssql_field_type int result int offset mssql_free_result Free result memory Description int mssql_free_result int result mssql_free_result only needs to be called if you are worried about using too much memory while your script is running. All result memory will automatically be freed when the script, you may call mssql_free_result with the result identifier as an argument and the associated result memory will be freed. mssql_get_last_message Returns the last message from server (over min_message_severity?) Description string mssql_get_last_message void mssql_min_error_severity Sets the lower error severity Description void mssql_min_error_severity int severity mssql_min_message_severity Sets the lower message severity Description void mssql_min_message_severity int severity mssql_num_fields Get number of fields in result Description int mssql_num_fields int result Mssql_num_fields returns the number of fields in a result set. See also: mssql_db_query, mssql_query, mssql_fetch_field, and mssql_num_rows. mssql_num_rows Get number of rows in result Description int mssql_num_rows string result Mssql_num_rows returns the number of rows in a result set. See also: mssql_db_query, mssql_query, and mssql_fetch_row. mssql_pconnect Open persistent MS SQL connection Description int mssql_pconnect string servername string username string password Returns: A positive MS SQL persistent link identifier on success, or false on error. Mssql_pconnect acts very much like mssql_connect with two major differences. First, when connecting, the function would first try to find a (persistent) link that's already open with the same host, username and password. If one is found, an identifier for it will be returned instead of opening a new connection. Second, the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use (mssql_close will not close links established by mssql_pconnect). This type of links is therefore called 'persistent'. mssql_query Send MS SQL query Description int mssql_query string query int link_identifier Returns: A positive MS SQL result identifier on success, or false on error. Mssql_query sends a query to the currently active database on the server that's associated with the specified link identifier. If the link identifier isn't specified, the last opened link is assumed. If no link is open, the function tries to establish a link as if mssql_connect was called, and use it. See also: mssql_db_query, mssql_select_db, and mssql_connect. mssql_result Get result data Description int mssql_result int result int i mixed field Mssql_result returns the contents of one cell from a MS SQL result set. The field argument can be the field's offset, or the field's name, or the field's table dot field's name (tablename.fieldname). If the column name has been aliased ('select foo as bar from...'), use the alias instead of the column name. When working on large result sets, you should consider using one of the functions that fetch an entire row (specified below). As these functions return the contents of multiple cells in one function call, they're MUCH quicker than mssql_result. Also, note that specifying a numeric offset for the field argument is much quicker than specifying a fieldname or tablename.fieldname argument. Recommended high-performance alternatives: mssql_fetch_row, mssql_fetch_array, and mssql_fetch_object. mssql_select_db Select MS SQL database Description int mssql_select_db string database_name int link_identifier Returns: true on success, false on error Mssql_select_db sets the current active database on the server that's associated with the specified link identifier. If no link identifier is specified, the last opened link is assumed. If no link is open, the function will try to establish a link as if mssql_connect was called, and use it. Every subsequent call to mssql_query will be made on the active database. See also: mssql_connect, mssql_pconnect, and mssql_query