Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

184
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda