0

Im trying to get modern and use mysqli like this

$connect = mysqli_connect($servername, $username, $password);
mysql_select_db($dbname);

but it dosent work,

This works

$connect = mysql_connect($servername, $username, $password);
mysql_select_db($dbname);

am i just tired or is it completly wrong?

1 Answers1

2

The mistake is in your select database line, you did mix it with mysql_* when you should use mysqli_*

Your should use mysqli_select_db for selecting database using mysqli_* extension.

Your final code would be something like this:

$connect = mysqli_connect($servername, $username, $password);
mysqli_select_db($connect, $dbname);
Keep Coding
  • 636
  • 9
  • 26