Home  >  Article  >  Backend Development  >  php cannot select database

php cannot select database

angryTom
angryTomOriginal
2019-10-28 13:09:143798browse

php cannot select database

php cannot select the database

We may report the following error when selecting the database. How to solve it? Get up and study.

Warning: mysqli_select_db() expects exactly 2 parameters, 1 given in D:\wamp\www\test\connect.php on line 8

When PHP connects to the database:

There is no problem connecting to the database with mysqli_connect, but there is always an error when using mysqli_select_db!

After careful observation of mysql_select_db and mysqli_select_db, I found that

●The incoming parameters of mysql_select_db are (databaseName, query);

●The incoming parameters of mysqli_select_db are (query, databaseName );

The order of the incoming parameters of the two connection methods is not the same, so the selection fails.

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of php cannot select database. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Related articles

See more