0

I got a problem while connecting to db even if my details are accurate like db_name, db_username, db_password and servername also and i tried lot things like i tried to connect it with mysql_connect(), mysqli_connect() and PDO also but everything fails please some one help me with this problem.

$mysqli = new mysqli("localhost","credai_nashik","$1ePJv0|i,5>","credai_nashik-313235aa94");

// Check connection
if ($mysqli -> connect_errno) {
  echo "Failed to connect to MySQL: " . $mysqli -> connect_error;
  exit();
}
Dharman
  • 30,962
  • 25
  • 85
  • 135

1 Answers1

-2

You should use PDO. Try with this syntax:

        $dbConnection = new PDO('mysql:host=' . $host . ';dbname=' . $db, $user, $pass, [
            PDO::ATTR_EMULATE_PREPARES => false,
            PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
        ]);
delboy1978uk
  • 12,118
  • 2
  • 21
  • 39