Fwd: MySQLi extension basic examples

Kamil Tekiela <[email protected]>
Newsgroups gmane.comp.php.documentation.general
Message-ID <CAGBsUrcCMUhHyjcAftS=Bs9f+kLz4KfHy4BH1pK23r-RUQRzGQ@mail.gmail.com>
I probably should have sent this here

---------- Forwarded message ---------
From: Kamil Tekiela <[email protected]>
Date: Sat, 28 Nov 2020 at 16:26
Subject: MySQLi extension basic examples
To: <[email protected]>


Hi Internals,

I would like to hear your opinions about the following page in the PHP manual:
https://www.php.net/manual/en/mysqli.examples-basic.php

Currently, this is the only "example" apart from the quick start
guide. There is a whole section
https://www.php.net/manual/en/mysqli.examples.php which suggests that
there were more or that there was meant to be more examples, however
there is only that one example now.

People have complained about the quality of this example for a number
of years, including myself. The page does not show best practices,
encourages SQL injection, poor error handling, and lacks prepared
statement example. As a result, it does more harm than good.

There are two possible solutions. 1. Get rid of the examples section.
2. Write a proper mysqli example. While I could create a PR suggesting
a better example, I would advise that we remove it completely. This
API is not suited to be used directly in business logic. This
functionality should be wrapped in a database abstraction layer. For
this reason, this example is not much more useful than the examples
located on each function's own page. Users writing abstraction
libraries are interested more in an example for a particular function
rather than an overall example.

What are your opinions? Would it be ok to remove that page?

Best Regards,
Kamil Tekiela
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.