Skip to content

Latest commit

 

History

History
54 lines (41 loc) · 1.24 KB

sqlsrv-has-rows.md

File metadata and controls

54 lines (41 loc) · 1.24 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic helpviewer_keywords
sqlsrv_has_rows
sqlsrv_has_rows
David-Engel
davidengel
01/19/2017
sql
connectivity
reference
API Reference, sqlsrv_has_rows
sqlsrv_has_rows

sqlsrv_has_rows

[!INCLUDEDriver_PHP_Download]

Indicates if the result set has one or more rows.

Syntax

  
sqlsrv_has_rows( resource $stmt )  

Parameters

$stmt: The executed statement.

Return Value

If there are rows in the result set, the return value will be true. If there are no rows, or if the function call fails, the return value will be false.

Example

<?php  
   $server = "server_name";  
   $conn = sqlsrv_connect( $server, array( 'Database' => 'Northwind' ) );  
  
   $stmt = sqlsrv_query( $conn, "select * from orders where CustomerID = 'VINET'" , array());  
  
   if ($stmt !== NULL) {  
      $rows = sqlsrv_has_rows( $stmt );  
  
      if ($rows === true)  
         echo "\nthere are rows\n";  
      else   
         echo "\nno rows\n";  
   }  
?>  

See Also

SQLSRV Driver API Reference