title: Get number of rows in SQL-Server with PHP
body: <p>I am fairly new to SQL-Server and PHP, but I'm trying to get the total number of rows in my table with PHP.</p>
  
  <p>This is the code I am using, it connects just fine, however it won't print the number of rows:</p>
  
  <pre><code>&lt;?php
  $serverName = "SERVER1\SQLEXPRESS";
  $connectionInfo = array( "Database"=&gt;"petitionlist");
  $conn = sqlsrv_connect( $serverName, $connectionInfo);
  if( $conn === false )
  {
       ?&gt;
          &lt;b&gt;Error: &lt;/b&gt;Could not connect to the server database.
       &lt;?php
       die( print_r( sqlsrv_errors(), true));
  }
  $tsql = "Select Count(*) from SignatureTable";
  $stmt = sqlsrv_query( $conn, $tsql);
  if( $stmt === false )
  {
       ?&gt;
       &lt;b&gt;Error: &lt;/b&gt;
       &lt;?php
       die( print_r( sqlsrv_errors(), true));
  }
      ?&gt;
      &lt;b&gt;Result:&lt;/b&gt;&lt;br /&gt;
      &lt;?php
  print_r(sqlsrv_fetch_object($stmt));
  
  sqlsrv_free_stmt( $stmt);
  sqlsrv_close( $conn);
  ?&gt;
  </code></pre>
  
  <p>If I execute the "Select Count(*) from SignatureTable" command on the SQL Server Studio it returns the correct number.  So It's not my server, it's my code.</p>