What are the potential pitfalls of not using quotation marks when passing parameters in a MySQL connection string in PHP?

If quotation marks are not used when passing parameters in a MySQL connection string in PHP, it can lead to syntax errors or unexpected behavior. To avoid this issue, always enclose the parameters in quotation marks to ensure that they are properly interpreted by the database.

// Incorrect way without using quotation marks
$servername = localhost;
$username = root;
$password = password;
$database = dbname;

// Correct way with quotation marks
$servername = "localhost";
$username = "root";
$password = "password";
$database = "dbname";

// Create connection
$conn = new mysqli($servername, $username, $password, $database);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";