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.
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:
Basically you didn’t check the connection, and ended up using a
$servidor
invalid in the sequence– Bacco
@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.– Leo
It’s still the same reason, you missed a connection error without treating or are using the wrong variable in the 1st parameter.
– Bacco