Re: docs on mysqli_query return values are incorrect.
[email protected] (Anna Filina)
| Newsgroups | php.doc |
|---|---|
| Message-ID | <CAEhKdmvB-ygDPvn3aWmLgekX-a_b_+bGodPA8rCn6Jaagv=0pw@mail.gmail.com> |
I opened a PR with that suggesiton. We can continue the conversation in the comments over there. https://github.com/php/doc-en/pull/324 Anna On Sun, Jan 10, 2021 at 6:57 AM Rowan Tommins <[email protected]> wrote: > 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] >