首页 >函数列表 >mssql_query

mssql_query

mssql_query

(PHP 4, PHP 5, PECL odbtp >= 1.1.1)

mssql_querySend MS SQL query

说明

mixed mssql_query ( string $query [, resource $link_identifier [, int $batch_size = 0 ]] )

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.

范例

Example #1 mssql_query() 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);
?>

注释

Note:

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_bind
  • mssql_close
  • mssql_connect
  • mssql_data_seek
  • mssql_execute
  • mssql_fetch_array
  • mssql_fetch_assoc
  • mssql_fetch_batch
  • mssql_fetch_field
  • mssql_fetch_object
  • mssql_fetch_row
  • mssql_field_length
  • mssql_field_name
  • mssql_field_seek
  • mssql_field_type
  • mssql_free_result
  • mssql_free_statement
  • mssql_get_last_message
  • mssql_guid_string
  • mssql_init
  • mssql_min_error_severity
  • mssql_min_message_severity
  • mssql_next_result
  • mssql_num_fields
  • mssql_num_rows
  • mssql_pconnect
  • mssql_query
  • mssql_result
  • mssql_rows_affected
  • mssql_select_db
  • PHP MySQL HTML CSS JavaScript MSSQL AJAX .NET JSP Linux Mac ASP 服务器 SQL jQuery C# C++ java Android IOS oracle MongoDB SQLite wamp 交通频道