php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #77449 Bug in example PHP Documentation
Submitted: 2019-01-12 12:32 UTC Modified: 2019-01-12 12:37 UTC
From: p_i at ukr dot net Assigned:
Status: Closed Package: Documentation problem
PHP Version: 7.2.14 OS: CentOS 7
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: p_i at ukr dot net
New email:
PHP Version: OS:

 

 [2019-01-12 12:32 UTC] p_i at ukr dot net
Description:
------------
---
From manual page: https://php.net/mysqli.query
---

Please replace $result->free instead $result->close(). The close () method for the mysql_result class does not exist.

Example #1 mysqli::query() example
Object oriented style
...
...
...
if ($result = $mysqli->query("SELECT * FROM City", MYSQLI_USE_RESULT)) {

    /* Note, that we can't execute any functions which interact with the
       server until result set was closed. All calls will return an
       'out of sync' error */
    if (!$mysqli->query("SET @a:='this will not work'")) {
        printf("Error: %s\n", $mysqli->error);
    }
    $result->close();
}

$mysqli->close();






Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-01-12 12:37 UTC] p_i at ukr dot net
-Status: Open +Status: Closed
 [2019-01-12 12:37 UTC] p_i at ukr dot net
mysqli_result::close ( void ) is alias to mysqli_result::free ( void ), sorry.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 22:00:01 2026 UTC