PHP operates mysql database

Through the study of the previous chapter, we have finished learning MySQL. PHP sending data to MySQL and PHP operating the MySQL database are the key points.

Let me give you some examples:

  1. To register a user, you need to POST the form data to PHP and write it into the database
  2. To purchase a product, you need to POST it into the database Product information and user information are written into the database through PHP
  3. Online payment is to write the user's recharge information into the database through PHP
  4. After modifying the avatar address for uploading the avatar, modify the database through PHP The value of the avatar field inside is

... There are too many application scenarios. From web pages, mobile terminals, and QQ WeChat public accounts, PHP is used to connect to the database for operations.

In order to make it easier for everyone to learn, we have divided the knowledge of connecting to the database into steps. You will find that you can easily learn how to connect to the database with PHP.

The database connection knowledge we have prepared is applicable to almost all database connection methods.

You can also use this set of solutions and steps for database connection functions such as PDO and PgSQl.

Before we officially start learning, we need to enable the mysqli extension. Using phpinof(), you can see the following display, indicating that the opening is successful:

If there is no mysqli extension module. I have studied with you in the "10.PHP Image Processing" chapter. If you do not see the mysqli extension under the windows server, open the php.ini file and open php_mysqli.dll.


Note:

Starting from PHP7, the mysql extension is no longer supported by default, that is, the mysql_* series of functions are no longer supported. Please use mysqli to connect to the database.

mysqli supports both php5 and php7.

Continuing Learning
||
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!