Re: docs on mysqli_query return values are incorrect.
[email protected] (Rowan Tommins)
| Newsgroups | php.doc |
|---|---|
| Message-ID | <[email protected]> |
On 5 January 2021 00:12:24 GMT+00:00, j adams <[email protected]> wrote: >There is a problem with the return value description for mysqli_query, >displayed here: >https://www.php.net/manual/en/mysqli.query.php > >Under 'Return Values,' it says: > >>Returns *false* on failure. For successful SELECT, SHOW, DESCRIBE or >EXPLAIN queries *mysqli_query()* will return a mysqli_result ><https://www.php.net/manual/en/class.mysqli-result.php> object. For >other >successful queries *mysqli_query()* will return *true* > >This is not correct. I can provide one counterexample, which is when >you >run an optimize query: > >OPTIMIZE TABLE my_table; Hi, If I'm understanding this right, I think the documentation just needs to be a bit vaguer - there's probably other rare queries that return a result set, but the ones listed are the most common. Even if we could list every such query now, a new version of MySQL or MariaDB might come out tomorrow with a new feature which produced a result set, and the function would return a result object for it. Perhaps it should read something like this: > For queries which produce a result set, such as > SELECT, SHOW, DESCRIBE or EXPLAIN, mysqli_query() will return a mysqli_result object... Regards, -- Rowan Tommins [IMSoP]