mssql_query Send MS SQL query php函数


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_result Get result data
mssql_rows_affected Returns the number of records affected by the query
mssql_select_db Select MS SQL database
mt_getrandmax 显示随机数的最大可能值
mt_rand 生成更好的随机数
mt_srand 播下一个更好的随机数发生器种子
mysqli_bind_param mysqli_stmt_bind_param的别名
mysqli_bind_result mysqli_stmt_bind_result的别名
mysqli_client_encoding mysqli_character_set_name的别名
mysqli_connect 别名 mysqli::__construct
mysqli_disable_reads_from_master 禁用从主机读取
mysqli_disable_rpl_parse 禁用RPL解析
mysqli_enable_reads_from_master 开启从主机读取
mysqli_enable_rpl_parse 开启RPL解析
快速导航

Copyright © 2016 phpStudy |