Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

186
Visualizações
Php Fetch Results into the table

Below are my codes, However, I didn't get a table as I expect. Rather than the first row only seeming to be ok, Other Rows are not coming in the table. Please refer to the photo.

    $Sql = "SELECT Registration_Number,Name FROM vta";
    
    $Result = $conn->Query($Sql);
    
    
    if ($Result -> num_rows> 0) {    
        echo "<table border=2> 
            <tr><th>Registration_Number</th>
            <th>Name</th></tr>";
    
        while ($Row = $Result->fetch_assoc()) {
            // $Rm=$Row['Registration_Number'];
            // $Nm = $Row['Name'];
    
            echo "<tr><td>$Row[Registration_Number]</td><td>$Row[Name]</td></tr></table>";
        }
    }
    
    $conn->Close();

enter image description here

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You have to move the closing </table> outside the loop.

$Sql = "SELECT Registration_Number,Name FROM vta";

$Result = $conn->Query($Sql);


if($Result->num_rows > 0) {
    echo "<table border=2> 
        <tr><th>Registration_Number</th>
        <th>Name</th></tr>";

    while ($Row = $Result->fetch_assoc()){
        echo "<tr><td>$Row['Registration_Number']</td><td>$Row['Name']</td></tr>";
    }

    echo '</table>';
}

$conn->Close();
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda