-1
I try to make the connection in my comic, but keeps giving the error "Failed to connect!"
The data in my comic book is:
Data Base: a test Table: customers
trying to connect by PHP
<?php
$conn = @mysqli_connect("localhost", "root", "", "teste") or die("Falha ao conectar!");
?>
and validation:
<?php
require_once "conexao.php";
$email = $_GET['idemail'];
$cpf = $_GET['cpf'];
$query = "SELECT * FROM clientes WHERE cpf = '$cpf' AND email = '$email'";
$querySelect = mysqli_query($conn,$query);
if(mysqli_num_rows($querySelect) <=0){
echo"<script type='text/javascript'>alert('Email ou cpf incorretos');window.location.href='index.html';</script>";
die();
}else{
setcookie("login", $cpf);
header("Location:Postagem.html");
}
But whenever I put the correct or incorrect data that is in my comic, gives the same error "Failure to connect!"
check if you really have a database with a test, root user and empty password. or change your error message to write which error you made, not just which failed
– Erick Weil
I changed the error message and when I go to test, it gives the same previous message
– Maria
the problem is in the connection file, remove@, it is suppressing the errors. switch to or die("Failed to connect!". mysqli_connect_error());
– Erick Weil
keeps making the same mistake
– Maria
but what about the additional information? nothing? no more messages? if you have removed @ and put mysqli_connect_error() in the log, and yet have not changed anything, I must ask, you have saved the file?
– Erick Weil
Right to change to : $Conn = ("localhost", "root", ""test") or die("Failed to connect!".mysqli_connect_error()); , and I saved nothing, and I saved it
– Maria