PHP & Mysql simple connection

Website URL

http://varvic.wuaze.com/

Error Message

connect_error) { die ("Connection failed: " . $conn->connect_error); } else { echo “Connected Successfully”; } ?>

Other Information

I have the following PHP code (will destroy the sample database later, credentials will work) but I cant create a successful connection. Any guess? Thanks for the help!

<?php

$servername = "sql305.infinityfree.com";
$username = "if0_38856985";
$password = "hHhxHp7ZPDXFTZ";
$dbname = "if0_38856985_clients";

// Create Connection

$conn = mysqli_connect($username, $servername, $password, $dbname);

//Check Connection

if ($conn->connect_error) {

die ("Connection failed: " . $conn->connect_error);

}

else {

echo "Connected Successfully";

}

?>

@vicvicvar

You just exposed your password, this topic is hidden until you change it.

4 Likes

I just reset your hosting account password.

Please be aware that this is a public forum, and anything you write here can be seen by anyone. So make sure to not share any sensitive data here (like passwords!).


As for the issue itself, you say that you are unable to connect to the database? If so, this line in your code should show the reason why it doesn’t work. What is the error message you see?

die ("Connection failed: " . $conn->connect_error);
5 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.