How to operate MySQL database with PHP - how to select a database file. In our daily PHP development work, when we want to obtain data from the database, after PHP connects to the database, the next step is to select the database file. A function is used, the mysql_select_db() function selects the database! Before choosing a database, the first thing we do is connect PHP to the database. We have detailed how to establish a connection in the previous article "Using the mysql_connect() function to connect to the database (Method 1 of PHP operating MySQL database)". I won’t introduce much here. Today we will mainly talk about the mysql_select_db() function! The syntax format of the mysql_select_db() function is as follows: mysql_select_db(string database name[,resource link_identifier]) or: mysql_query("use database name"[,resource&
1. About selecting database files Detailed introduction
Introduction: How to operate MySQL database with PHP - How to select database files in our daily PHP During development work, when we want to obtain data from the database, after connecting to the database in PHP, the next step is to select the database file, and we need to use a function, the mysql_select_db() function to select the database! The first thing to do is to connect PHP to the database. We discussed this in the previous article "Using the mysql_connect() function to connect to the database (How PHP operates the MySQL database...
##2. Use the mysql_select_db() function to select the database file (method 2 of PHP operating MySQL database)
Introduction : In our daily PHP development work, when we want to obtain data from the database, after PHP connects to the database, the next step is to select the database file, and we need to use a function, the mysql_select_db() function to select the database!
3. The difference between mysql_db_query and mysql_query
Introduction: I won’t talk about the difference. Just look at the above examples. Got it, the main difference is that there is one more mysql_select_db. Regarding performance, the use of this function is not recommended since PHP 4.0.6. Do not use this function. Use mysql_select_db() and mysql_query() instead##.
#4.CAPI function description (S-W)
Introduction: 25.2.3.59. mysql_select_db() int mysql_select_db(MYSQL *mysql, const char *db ) Description Makes the database specified by db the default database (the current database) on the connection specified by mysql. In subsequent queries, this database will be the default database referenced by tables that do not contain an explicit database separator.5.
PHP self-study tutorial for MySQL database
Introduction: General steps for PHP to access MySQL database: 1. Connect to the MySQL database: Use the mysql_connect() function to establish a connection to the MySQL server. 2. Select the MySQL database: Use the mysql_select_db() function to select the database on the MySQL database server. 3. Execute the SQL statement: use the mysql_query() function in the selected databaseThe above is the detailed content of Recommended articles about mysql_select_db(). For more information, please follow other related articles on the PHP Chinese website!