0
Before migrating to the ". Xyz" domain on Hostinger, the following script worked normally. Now it does not access the data.
Why not 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 does it not display the total number of records? - Line 32 - The table has 17 records 2) Why does the While loop not work? - Line 38
Try to edit your question, it’s a mess. We don’t know the lines of the code you’re talking about, put a commit saying "problem 1)" or something like that. And explain better what the problem is.
– Pbras
In the meantime if you’re trying to change domains you also had to change the database? Then you have to import the database tables.
– Pbras