This question already has an answer here:
I am new to PHP, and have encountered many problems with some code that I am writing that I have been able to solve. But, one problem seems to never disappear. I constantly receive the error message Fatal error: Non-static method mysqli::select_db() cannot be called statically
. The code the error refers to will be below. If anyone has a solution to this problem, as well as an explanation, that would be most helpful.
$db_selected = mysqli::select_db($link, DB_NAME);
if (!$db_selected) {
die('Can\'t use ' . DB_NAME . ': ' . mysql_error());
}
EDIT
Other Stack Exchange questions are not helpful for this situation. Explaining to me the fact my question is low-level does not help, as I already understand that and acknowledged it above.
</div>
$db_selected = mysqli_select_db($link, DB_NAME);
if (!$db_selected) {
die('Can\'t use ' . DB_NAME . ': ' . mysql_error());
}
You're trying to call a function that's not avaiable, you have to choose a DB like above.
Edit:
But i recommend just selected the DB when you're instantiating the connection like this:
$mysqli = mysqli_connect('HOST', 'USEER', 'PASS', 'DB');