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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php at gosoftware dot com dot au
New email:
PHP Version: OS:

 

 [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 17:01:29 2024 UTC