如何修复MYSQLi Select DB需要精确的2个参数

I'm having a problem with my mysqli code, error is here:

Warning: mysqli_select_db() expects exactly 2 parameters, 1 given in C:\xampp\htdocs\account\login\auth.php on line 3

Here is my code in auth.php

$db = mysqli_connect('localhost', 'root', '', 'tc');
mysqli_select_db($db) or die(mysqli_error($db));

please read this link

mysqli_select_db() expects exactly 2 parameters

By second parameter

Selects the default database to be used when performing queries against the database connection

Your problem is the difference between the procedural variant and the object oriented variant also you are not adding the database schema name, which is different from the database connection link.

Within your code you are trying to use the object oriented variant (1 parameter) in something like a procedural way.

$dbo->mysqli_select_db("database schema name"); // Object oriented way

mysqli_select_db($db, "database schema name"); // Procedural way

Please note that within a database management system there could be multiple database schemas. Often the term "database" is used for the database management system as well as for a database schema. For example when talking about the MySQL database - the database management system is meant.

So when reading the PHP manual you should keep an eye on the procedural vs object oriented variant, and on the excact parameters that are required for each command.