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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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: Fri Oct 09 22:00:02 2026 UTC