Forum Discussion
Wasidigital
Mar 13, 2024Copper Contributor
DB Connectivity Error
<?php $servername = "localhost"; $username = "username"; $password = "password'; $database = "ytmp3_db"; // Create connection $conn = new mysqli($serverneme, $username, $password, $database); // Che...
SivertSolem
Apr 03, 2024Iron Contributor
I'm going to assume your formatting broke, and that there's actual line feeds in your code, so your comments are not what's breaking your connection.
<?php
$servername = "localhost";
$username = "username";
$password = "password';
$database = "ytmp3_db";
// Create connection
$conn = new mysqli($serverneme, $username, $password, $database);
// Check connection
if ($conn->connect_error) {
die('Connection failed: " . $conn->connect_error);
}
?>
It appears as though you've mixed double and single quotes on your strings. You need to pick one and stick with it.
$password = "password'
die('Connection failed:" . $conn->connect_error)