Warning: mysqli_select_db() expects exactly 2 parameters, 1 given
mysqli_select_db()
should have 2 parameters, the connection link and the database name -
mysqli_select_db($con, 'phpcadet') or die(mysqli_error($con));
Using mysqli_error
in the die statement will tell you exactly what is wrong as opposed to a generic error message.
This error message is telling you that you need to provide the mysqli connection object as the first argument to the mysqli_select_db()
function. Most of mysqli functions require the mysqli object when used in the procedural style.
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$con = mysqli_connect('localhost', 'root', 'PwdSQL5');
mysqli_select_db($con, 'phpcadet')
// ^^^^ - pass the $con object from the line above
However, you don't need to use mysqli_select_db()
at all. You can pass the database name as the fourth argument to the mysqli_connect()
function. All you need is this:
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$con = mysqli_connect('localhost', 'root', 'PwdSQL5', 'phpcadet');
// the database name - ^^^^^^