PHP can access MySQL databases using a number of libraries. Two of them are mysqli and PDO, both part of standard PHP. mysqli provides functions to manipulate data in a MySQL database. PDO, as stated on the PHP website:
The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for accessing databases in PHP. Each database driver that implements the PDO interface can expose database-specific features as regular extension functions. Note that you cannot perform any database functions using the PDO extension by itself; you must use a database-specific PDO driver to access a database server.
PDO provides a data-access abstraction layer, which means that, regardless of which database you’re using, you use the same functions to issue queries and fetch data. PDO does not provide a database abstraction; it doesn’t rewrite SQL or emulate missing features. You should use a full-blown abstraction layer if you need that facility.
PDO ships with PHP 5.1
The work to do is to modify the web application being written to make it save orders to a MySQL database instead of in a text file. The first thing to do is to decide upon a schema (i.e. tables and columns). The application will use PDO.
Prepared statements
In order to increase performance and security, it is advisable to use prepared statements when this is possible.
The work to do is to add to the web application a second report. This report should give, for each customer, the amount of phones bought and the cost. In case, the amount is more than 20, that customer should get 20% for this phone. If the number of phones is between 10 and 19, the customer should get 10% off.