0
Good Afternoon!
I am setting up a server to host an API, for my connection tests I am using the code below, however I can not make the connection to the database and nor see what error PHP returns. I’ve searched the internet and I don’t understand what’s wrong with my code. I’ve been able to connect and write to the bank with a Python script.
<?PHP
# PHP 7
$conexao = mysqli_connect('187.182.164.73','Admin','SENHA');
$banco = mysqli_select_db($conexao,'pessoa');
mysqli_set_charset($conexao,'utf8');
$sql = mysqli_query($conexao,"select * from tb_pessoa") or die(error_reporting(E_ALL));
while($dados=mysqli_fetch_assoc($sql))
{
echo $dados['nome'].'<br>';
}
?>
Utilize
mysqli_error
to verify which error.– Valdeir Psr
Need to change password urgently, your DB is exposed on the internet and you passed the credentials in the post.
– Bacco