MySQLi extension basic examples

From: Date: Sat, 28 Nov 2020 16:26:25 +0000
Subject: MySQLi extension basic examples
Groups: php.internals 
Request: Send a blank email to internals+get-112312@lists.php.net to get a copy of this message
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

« previous php.internals (#112312) next »