Re: docs on mysqli_query return values are incorrect.
| From: | Rowan Tommins | Date: | Sun, 10 Jan 2021 11:57:18 +0000 |
| Subject: | Re: docs on mysqli_query return values are incorrect. | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969387791@lists.php.net to get a copy of this message | ||
On 5 January 2021 00:12:24 GMT+00:00, j adams <zardozrocks@gmail.com> 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]