sqlsrv_has_rows

(No version information available, might only be in Git)

sqlsrv_has_rowsIndicates whether the specified statement has rows

说明

sqlsrv_has_rows ( resource $stmt ) : bool

Indicates whether the specified statement has rows.

参数

stmt

A statement resource returned by sqlsrv_query() or sqlsrv_execute().

返回值

Returns TRUE if the specified statement has rows and FALSE if the statement does not have rows or if an error occurred.

范例

Example #1 sqlsrv_has_rows() example

<?php
$server 
"serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName""UID"=>"username""PWD"=>"password" )
$conn sqlsrv_connect$server$connectionInfo );

$stmt sqlsrv_query$conn"SELECT * FROM Table_1");

if (
$stmt) {
   
$rows sqlsrv_has_rows$stmt );
   if (
$rows === true)
      echo 
"There are rows. <br />";
   else 
      echo 
"There are no rows. <br />";
}
?>

参见

相关文章
php ibm db2 函数 returns the number of rows affected by an sql statementphp frontbase 函数 get the number of rows affected by the last statementphp intl 函数 check whether the given error code indicates failurephp maxdb 函数 returns the total number of rows changed deleted or inserted by the last executed statementphp mysqlnd qc 函数 installs a callback which decides whether a statement is cachedphp 杂项 函数 indicates whether the codepage is utf 8 compatiblephp sqlite 函数 returns the number of rows that were changed by the most recent sql statementphp sqlite 函数 finds whether or not more rows are availablephp sqlite 函数 returns whether more rows are availablephp sqlsrv 函数 cancels a statementphp sqlsrv 函数 returns information about the client and specified connectionphp sqlsrv 函数 executes a statement prepared with sqlsrv preparephp sqlsrv 函数 retrieves metadata for the fields of a statement prepared by sqlsrv prepare or sqlsrv queryphp sqlsrv 函数 frees all resources for the specified statementphp sqlsrv 函数 returns the value of the specified configuration settingphp sqlsrv 函数 indicates whether the specified statement has rowsphp sqlsrv 函数 makes the next result of the specified statement activephp sqlsrv 函数 retrieves the number of fields columns on a statementphp sqlsrv 函数 retrieves the number of rows in a result setphp sqlsrv 函数 returns the number of rows modified by the last insert update or delete query executed
关注编程学问公众号