I made a login and registration system however I have a problem, every time I finish filling out the form and click send it gives me an error like this
"Warning: mysqli_connect (): (HY000 / 2005): Unknown MySQL server host '?' (0) in /home/marmo504/interestrar.liferedes.com.br/insert.php on line 19 Connection failed: Unknown MySQL server host '?' (0) "
I did everything and could not solve, could you help me?
Below the source code:
<?php
$servername = "#.br";
$username = "#";
$password = "#";
$dbname = "#";
// criar conexão
$conn = mysqli_connect("servername", "username", "password", "dbname");
// checar conexão
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT * FROM clientes";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
echo "- ID: " . $row["id"]. "<br> - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br> - E-mail: " . $row["email"] . "<br> - Data de Nascimento: " . $row["dat_nasc"] . "<br> - Cidade: " . $row["cidade"] . "<br><br>";
}
} else {
echo "0 results";
}
?>
<form action="#" method="link" style="margin-left:500px">
<input type="submit" value="Voltar">
</form>