Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic


SQL Server 2008 R2

Indicates if the result set has one or more rows.

sqlsrv_has_rows( resource $stmt )

$stmt: The executed statement.

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.

   $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";
         echo "\nno rows\n";
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.