php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #68248 Syntax error in example code
Submitted: 2014-10-17 07:48 UTC Modified: 2015-09-09 12:35 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: php at gosoftware dot com dot au Assigned: cmb (profile)
Status: Closed Package: sqlsrv (PECL)
PHP Version: 5.4.34 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
46 + 11 = ?
Subscribe to this entry?

 
 [2014-10-17 07:48 UTC] php at gosoftware dot com dot au
Description:
------------
---
From manual page: http://www.php.net/function.sqlsrv-num-fields
---
I believe that there is an error in the documentation page - one two many { characters in the example ...

I think that it should be ....

  // Example of sqlsrv_num_fields
  $sql = "SELECT * FROM Table_1";
  $query = sqlsrv_query($conn, $sql);
  if( $query === false) { die( print_r( sqlsrv_errors(), true)); }
  $numFields = sqlsrv_num_fields( $query );
  while( sqlsrv_fetch( $stmt )) {    
    for($i = 0; $i < $numFields; $i++) {   // Iterate through the fields of each row.
      echo sqlsrv_get_field($stmt, $i)." ";
      }
    echo "<br />";
    }


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-09-09 12:16 UTC] cmb@php.net
-Summary: I believe that there is an error in the documentation page +Summary: Syntax error in example code -Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem -Assigned To: +Assigned To: cmb
 [2015-09-09 12:34 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=337791
Log: fixed syntax error in sqlsrv_num_fields() example (closes #68248)
 [2015-09-09 12:35 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2015-09-09 12:35 UTC] cmb@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 20:01:29 2024 UTC