PHP error while trying to pull data from Mysql database

Asked

Viewed 88 times

0

Good morning guys, okay? I got a problem on the next one. I hosted my PHP site on a Server where there is the DNS and the main suffix of the network, so that the site can only be accessed internally in the company. On my PC where I use Wampserver, the application works normally, but after I passed to the Server and replicated the Database, with the same Password, DB name and etc.. has given me this mistake. Can anyone tell me why ?

NOTE: The error occurs even if I log into the Server localhost both by the direct link that the site is hosted. I’ve run connection tests directly on Mysql Workbench and worked normally.

inserir a descrição da imagem aqui

My connection is as follows:

<?php
$servidor = 'Mysql@localhost:3306';
$usuario = 'root';
$senha = '*******';
$dbname = 'valevip';

$connect = mysqli_connect($servidor, $usuario, $senha, $dbname);


if ($connect -> connect_error){
    die("Conexão falhou: " . $connect->connect_error);
}

And finally how the connection appears to me in the Workbench:

inserir a descrição da imagem aqui

  • Basically you didn’t check the connection, and ended up using a $servidor invalid in the sequence

  • @Bacco I changed the way I made the connection, now appeared different errors, not the connection. In my searches, returned errors of type PHP Warning: mysqli_query() expects parameter 1 to be mysqli, bool given in C:\inetpub\wwwroot\valevip\index.php on line 19. Some returned in bool others in null.

  • It’s still the same reason, you missed a connection error without treating or are using the wrong variable in the 1st parameter.

No answers

Browser other questions tagged

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