-5

I feel like I am beating a dead horse. I have tried many of the suggestion here including ; and "" and ; etc. and I keep getting the same error. Could someone give me a hand please? TIA This is my code:

// Connect to the database
$cn = mysqli_connect($db_host, $db_user, $db_pass) or die("Cannot connect to DB");
mysqli_select_db($conn $db_name) or die("Error accessing DB");

this is my result:

Parse error: syntax error, unexpected '$db_name' (T_VARIABLE) in G:\Apache24\htdocs\poster\config.inc.php on line 314

Shahzad Barkati
  • 2,532
  • 6
  • 25
  • 33

2 Answers2

1

I think you lack comma:

mysqli_select_db($conn,$db_name) or die("Error accessing DB");
Carl Binalla
  • 5,393
  • 5
  • 27
  • 46
1

PHP mysqli_connect() Function

<?php
   $con = mysqli_connect("localhost","my_user","my_password","my_db");

    // Check connection
    if (mysqli_connect_errno())
      {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
      }
    ?>
Aman Kumar
  • 4,533
  • 3
  • 18
  • 40