I'm new in using PHP. I made something simple to connect to MySQL and select a database:
$conn = mysqli_connect($db_host, $db_admin, $db_pass) or die(mysql_error());
// these variables are previously declared and initialized
$selected_db = mysql_select_db($db_name, $conn) or die(mysql_error());
When I tested it, I got a successfully-established connection and the following warning:
mysql_select_db() expects parameter 2 to be resource, object given
Why did this happen? How can I fix it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…