Before migrating to the ".xyz" domain in Hostinger, the following script would function normally. You can not access the data now.
Why do not you display the total number of records? - Line 32 Why does the While loop not work? - Line 38
<!DOCTYPE html> <! teste_conexao.php ><html>
<head>
<meta charset="UTF-8"/>
</head>
<?php
date_default_timezone_set('Brazil/East');
$host = "mysql.hostinger.com.br";
$usuario = "u340822322_rfmc";
$senha_conect = "n6XrRbxHFQ1T";
$bd = "u340822322_pcl1";
$conn = mysqli_connect($host, $usuario, $senha_conect, $bd);
if($conn){
echo "conectado"."<br>";
}else{
echo "nao conectado"."<br>";
die("Connection failed: " . mysqli_connect_error());
exit;
}
$data = date('d/m/y - H:i:s');
echo "<br>" . $data . "<br><br>";
echo "<br>passou aqui - 01";
$selecao = mysqli_query('SELECT * FROM tabela_precos');
$total = mysqli_num_rows($selecao); // numero de registros do arquivo
echo "<br>===<br> Nº de registros = " . $total . "<br>===<br>";
$linha=array();
$n=0;
echo "<br>passou aqui - 02";
while ($dados = mysqli_fetch_array($selecao)) {
echo "<br>passou aqui - 03";
$linha[]=$dados;
$linha1=$linha[$n]['nome_picole'];
echo $linha1 . "<br>";
$n++;
}
echo "<br>passou aqui - 04";
?>
<br>
finalizou aqui.
</html>
The result is:
conectado
16/10/18 - 08:09:03
passou aqui - 01
===
Nº de registros =
===
passou aqui - 02
passou aqui - 04
finalizou aqui.
1) Why do not you display the total number of records? - Line 32 - The table has 17 registers 2) Why does the While loop not work? - Line 38