Does not connect to database and returns no error

Asked

Viewed 78 times

0

Hello, I made my site by xampp in windows, when I went to migrate to ubunto I realized that simply mysql did not work, and nor returned any error, for example, in the initial page of the site I already use the mysqli_connect, even with wrong user does not return any error.

No need to show code, because in xampp works perfectly.

Making the connection:

$conn = mysqli_connect(SQL_HOST, SQL_USUARIO, SQL_SENHA, SQL_BANCO);

2 answers

0

Add the following lines to get the error:

// verificar a conexão
if (mysqli_connect_errno()){
  echo "Falha ao conectar ao servidor: " . mysqli_connect_error();
}

0

Solved the problem, actually looking at the log found that mysql was poorly installed, just reinstalled and everything worked right.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.