Query: mssql_query
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
MSSQL_QUERY(3) MSSQL_QUERY(3) mssql_query - Send MS SQL querySYNOPSISmixed mssql_query (string $query, [resource $link_identifier], [int $batch_size])DESCRIPTIONmssql_query(3) sends a query to the currently active database on the server that's associated with the specified link identifier.PARAMETERSo $query - An SQL query. o $link_identifier - A MS SQL link identifier, returned by mssql_connect(3) or mssql_pconnect(3). 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(3) was called, and use it. o $batch_size - The number of records to batch in the buffer.RETURN VALUESReturns a MS SQL result resource on success, TRUE if no rows were returned, or FALSE on error.EXAMPLESExample #1 mssql_query(3) example <?php // Connect to MSSQL $link = mssql_connect('KALLESPCSQLEXPRESS', 'sa', 'phpfi'); if (!$link || !mssql_select_db('php', $link)) { die('Unable to connect or select database!'); } // Do a simple query, select the version of // MSSQL and print it. $version = mssql_query('SELECT @@VERSION'); $row = mssql_fetch_array($version); echo $row[0]; // Clean up mssql_free_result($version); ?>NOTESNote If the query returns multiple results then it is necessary to fetch all results by mssql_next_result(3) or free the results by mssql_free_result(3) before executing next query.SEE ALSOmssql_select_db(3), mssql_connect(3). PHP Documentation Group MSSQL_QUERY(3)