mssql_query - Send MS SQL query
Вернуться к: Mssql Функции
mssql_query
(PHP 4, PHP 5, PECL odbtp >= 1.1.1)
mssql_query — Send MS SQL query
This function was REMOVED in PHP 7.0.0.
Alternatives to this function include:
Описание
mssql_query() sends a query to the currently active database on the server that's associated with the specified link identifier.
Список параметров
-
query
-
An SQL query.
-
link_identifier
-
A MS SQL link identifier, returned by mssql_connect() or mssql_pconnect().
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.
-
batch_size
-
The number of records to batch in the buffer.
Возвращаемые значения
Returns a MS SQL result resource on success, TRUE
if no rows were
returned, or FALSE
on error.
Примеры
Пример #1 mssql_query() example
<?php
// Connect to MSSQL
$link = mssql_connect('KALLESPC\SQLEXPRESS', '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);
?>
Примечания
Замечание:
If the query returns multiple results then it is necessary to fetch all results by mssql_next_result() or free the results by mssql_free_result() before executing next query.
Смотрите также
- mssql_select_db() - Select MS SQL database
- mssql_connect() - Open MS SQL server connection
Вернуться к: Mssql Функции